mirror of https://github.com/helloxz/dnmp.git
xiaoz
4 years ago
2 changed files with 36 additions and 39 deletions
@ -1,48 +1,45 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
#update system |
#更新软件 |
||||||
apt-get update |
apk update |
||||||
apt-get install -y wget |
#安装timezone |
||||||
#install nginx |
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 |
||||||
|
|
||||||
|
|
||||||
|
#安装nginx |
||||||
function install_nginx() { |
function install_nginx() { |
||||||
cd /usr/local |
#安装nginx |
||||||
#add user and group |
apk add nginx |
||||||
groupadd www |
wget -P /etc/nginx https://github.com/helloxz/dnmp/raw/main/php/nginx.conf |
||||||
useradd -M -g www www -s /sbin/nologin |
|
||||||
#download nginx |
|
||||||
wget http://soft.xiaoz.org/nginx/xcdn-binary-1.18-debian.tar.gz |
|
||||||
tar -zxvf xcdn-binary-1.18-debian.tar.gz |
|
||||||
rm -rf xcdn-binary-1.18-debian.tar.gz |
|
||||||
#add env |
|
||||||
#echo "export PATH=$PATH:/usr/local/nginx/sbin" >> /etc/profile |
|
||||||
#export PATH=$PATH:'/usr/local/nginx/sbin' |
|
||||||
#备份配置文件 |
|
||||||
cd /usr/local/nginx/conf |
|
||||||
cp nginx.conf nginx.conf.bak |
|
||||||
wget -P /usr/local/nginx/conf https://github.com/helloxz/dnmp/raw/main/php/nginx.conf |
|
||||||
} |
} |
||||||
|
#设置PHP |
||||||
#setting php |
|
||||||
function set_php(){ |
function set_php(){ |
||||||
|
#安装依赖 |
||||||
|
apk add autoconf gcc musl-dev g++ zlib-dev make |
||||||
|
#安装GD库 依赖 |
||||||
|
#apk add libpng-dev |
||||||
|
#设置php.ini |
||||||
cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini |
cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini |
||||||
#install gd ext |
#zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so |
||||||
apt-get update && apt-get install -y \ |
# |
||||||
libfreetype6-dev \ |
sed -i "s/www-data/www/g" /usr/local/etc/php-fpm.d/www.conf |
||||||
libjpeg62-turbo-dev \ |
#安装扩展 |
||||||
libpng-dev \ |
|
||||||
libmagickwand-dev --no-install-recommends \ |
|
||||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \ |
|
||||||
&& docker-php-ext-install -j$(nproc) gd |
|
||||||
#install xdebug and redis |
|
||||||
pecl install redis-5.1.1 \ |
pecl install redis-5.1.1 \ |
||||||
&& pecl install xdebug-2.8.1 \ |
&& pecl install xdebug-2.8.1 \ |
||||||
&& pecl install imagick \ |
&& docker-php-ext-enable redis xdebug |
||||||
&& docker-php-ext-enable redis xdebug imagick |
|
||||||
sed -i "s/www-data/www/g" /usr/local/etc/php-fpm.d/www.conf |
|
||||||
rm -rf /var/lib/apt/lists/* |
|
||||||
} |
} |
||||||
|
|
||||||
install_nginx && set_php |
|
||||||
chmod +x /usr/sbin/run.sh |
|
||||||
echo '-----------------------------' |
echo '-----------------------------' |
||||||
echo 'nginx + php install success.' |
echo 'nginx + php install success.' |
||||||
echo '-----------------------------' |
echo '-----------------------------' |
Loading…
Reference in new issue