diff --git a/Dockerfile b/Dockerfile index c8a3333..67bbc3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN apt-get -y install nginx php5-fpm php5-mysql php-apc pwgen python-setuptools RUN apt-get -y install php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl # tweak nginx config -RUN sed -i -e"s/worker_processes 1/worker_processes 5/" /etc/nginx/nginx.conf +RUN sed -i -e"s/worker_processes 1/worker_processes 5/" /etc/nginx/nginx.conf RUN sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /etc/nginx/nginx.conf RUN sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /etc/nginx/nginx.conf RUN echo "daemon off;" >> /etc/nginx/nginx.conf @@ -36,11 +36,18 @@ RUN sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc RUN sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" /etc/php5/fpm/php.ini RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf RUN sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /etc/php5/fpm/pool.d/www.conf +# fix ownership of sock file +RUN sed -i -e "s/user = www-data/user = nginx/g" /etc/php5/fpm/pool.d/www.conf +RUN sed -i -e "s/group = www-data/group = nginx/g" /etc/php5/fpm/pool.d/www.conf +RUN sed -i -e "s/listen.owner = www-data/listen.owner = nginx/g" /etc/php5/fpm/pool.d/www.conf +RUN sed -i -e "s/listen.group = www-data/listen.group = nginx/g" /etc/php5/fpm/pool.d/www.conf +RUN sed -i -e "s/;listen.mode = 0660/listen.mode = 0750/g" /etc/php5/fpm/pool.d/www.conf RUN find /etc/php5/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \; # nginx site conf RUN rm -Rf /etc/nginx/conf.d/* ADD ./nginx-site.conf /etc/nginx/conf.d/default.conf +#RUN sudo usermod -a -G www-data nginx # add test PHP file ADD ./index.php /usr/share/nginx/html/index.php diff --git a/index.php b/index.php index 0cde37f..1286126 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ diff --git a/nginx-site.conf b/nginx-site.conf index 5d312db..8f39516 100644 --- a/nginx-site.conf +++ b/nginx-site.conf @@ -32,6 +32,7 @@ server { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; }