From 3c09b1fdbe3aa1d009b466dd12b6056e1399797c Mon Sep 17 00:00:00 2001 From: xiaoz Date: Mon, 15 Mar 2021 16:38:24 +0800 Subject: [PATCH] change alpine --- php/Dockerfile | 9 +++++---- php/install.sh | 10 +++++++--- php/nginx.conf | 2 +- php/run.sh | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/php/Dockerfile b/php/Dockerfile index 8cfa501..d0b7cbe 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -1,6 +1,6 @@ FROM php:7.3-fpm-alpine3.12 -#设置时区 -ENV TZ=Asia/Shanghai +#设置时区,仅Debian需要 +#ENV TZ=Asia/Shanghai #工作目录 WORKDIR /root #复制安装脚本 @@ -8,10 +8,11 @@ COPY ./install.sh /root #复制启动脚本 COPY ./run.sh /usr/sbin #执行安装脚本 -RUN bash install.sh +RUN sh install.sh #暴露配置文件 -VOLUME /usr/local/nginx/conf/vhost +VOLUME /etc/nginx/conf.d VOLUME /var/www/html +VOLUME /var/log/nginx EXPOSE 80 EXPOSE 443 #运行crontab和nginx diff --git a/php/install.sh b/php/install.sh index 75fb641..3105c12 100644 --- a/php/install.sh +++ b/php/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh #更新软件 apk update #安装timezone @@ -19,7 +19,7 @@ apk add wget function install_nginx() { #安装nginx apk add nginx - wget -P /etc/nginx https://github.com/helloxz/dnmp/raw/main/php/nginx.conf + #wget -P /etc/nginx https://github.com/helloxz/dnmp/raw/main/php/nginx.conf } #设置PHP function set_php(){ @@ -38,7 +38,11 @@ function set_php(){ && docker-php-ext-enable redis xdebug } - +#清理工作 +function run_clean(){ + apk del autoconf gcc musl-dev g++ zlib-dev make wget +} +install_nginx && set_php && run_clean echo '-----------------------------' echo 'nginx + php install success.' diff --git a/php/nginx.conf b/php/nginx.conf index c14c21e..6ec146b 100644 --- a/php/nginx.conf +++ b/php/nginx.conf @@ -1,4 +1,4 @@ -user www www; +user www-data www-data; worker_processes auto; worker_rlimit_nofile 50000; error_log logs/error.log; diff --git a/php/run.sh b/php/run.sh index 57073c4..8821eff 100644 --- a/php/run.sh +++ b/php/run.sh @@ -1,6 +1,6 @@ #!/bin/bash #start nginx -/usr/local/nginx/sbin/nginx +/usr/sbin/nginx echo 'start nginx success.' #start php-fpm /usr/local/sbin/php-fpm \ No newline at end of file