Docker + nginx + MySQL + PHP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

4 years ago
#!/bin/sh
4 years ago
#更新软件
apk update
#安装timezone
apk add -U tzdata
#查看时区列表
ls /usr/share/zoneinfo
#拷贝需要的时区文件到localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#查看当前时间
date
#为了精简镜像,可以将tzdata删除了
apk del tzdata
#安装wget
apk add wget
4 years ago
chmod +x /usr/sbin/run.sh
4 years ago
#安装nginx
4 years ago
function install_nginx() {
4 years ago
#安装nginx
apk add nginx
4 years ago
mkdir -p /run/nginx/
4 years ago
#wget -P /etc/nginx https://github.com/helloxz/dnmp/raw/main/php/nginx.conf
4 years ago
}
4 years ago
#设置PHP
function set_php(){
#安装依赖
4 years ago
apk add --no-cache autoconf gcc musl-dev g++ zlib-dev make libpng libpng-dev libjpeg-turbo-dev libwebp-dev zlib-dev libxpm-dev
4 years ago
#安装GD库 依赖
#apk add libpng-dev
#设置php.ini
4 years ago
cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
4 years ago
#zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
4 years ago
#sed -i "s/www-data/www/g" /usr/local/etc/php-fpm.d/www.conf
4 years ago
#安装扩展
4 years ago
docker-php-ext-install gd
4 years ago
pecl install redis-5.1.1 \
4 years ago
&& pecl install xdebug-2.8.1 \
4 years ago
&& docker-php-ext-enable redis xdebug
4 years ago
}
4 years ago
#清理工作
function run_clean(){
4 years ago
apk del autoconf gcc musl-dev g++ zlib-dev make libpng libpng-dev libjpeg-turbo-dev libwebp-dev zlib-dev libxpm-dev
4 years ago
#清理编译
rm -rf /var/cache/apk/*
4 years ago
}
install_nginx && set_php && run_clean
4 years ago
4 years ago
echo '-----------------------------'
echo 'nginx + php install success.'
echo '-----------------------------'