From 14ea837229c931fa6122d7f01f95163356d23d46 Mon Sep 17 00:00:00 2001 From: Simon Rupf Date: Sun, 3 Jun 2018 20:33:50 +0200 Subject: [PATCH] switching to unix socket for communication between nginx & php-fpm, improves performance and fixes #1 --- Dockerfile | 7 +++---- etc/nginx/sites-available/site.conf | 2 +- usr/local/etc/php-fpm.d/50-socket.conf | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 usr/local/etc/php-fpm.d/50-socket.conf diff --git a/Dockerfile b/Dockerfile index 9d7a28b..a33fb40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,14 +40,13 @@ RUN \ && export GNUPGHOME="$(mktemp -d)" \ && gpg2 --list-public-keys || /bin/true \ && curl -s https://privatebin.info/key/rugk.asc | gpg2 --import - \ + && rm -rf /var/www/* \ && cd /tmp \ && curl -Ls https://github.com/PrivateBin/PrivateBin/releases/download/${RELEASE}/PrivateBin-${RELEASE}.tar.gz.asc > PrivateBin-${RELEASE}.tar.gz.asc \ && curl -Ls https://github.com/PrivateBin/PrivateBin/archive/${RELEASE}.tar.gz > PrivateBin-${RELEASE}.tar.gz \ && gpg2 --verify PrivateBin-${RELEASE}.tar.gz.asc \ - && tar -xzf PrivateBin-${RELEASE}.tar.gz \ - && rm -rf /var/www \ - && mv /tmp/PrivateBin-${RELEASE} /var/www \ && cd /var/www \ + && tar -xzf /tmp/PrivateBin-${RELEASE}.tar.gz --strip 1 \ && rm *.md cfg/conf.sample.php \ && mv cfg /srv \ && mv lib /srv \ @@ -65,7 +64,7 @@ ADD etc/ /etc/ ADD usr/ /usr/ # mark dirs as volumes that need to be writable, allows running the container --read-only -VOLUME /srv/data /tmp /var/tmp /var/run /var/log +VOLUME /srv/data /tmp /var/tmp /run /var/log EXPOSE 80 diff --git a/etc/nginx/sites-available/site.conf b/etc/nginx/sites-available/site.conf index a8c2a9e..d17ec18 100644 --- a/etc/nginx/sites-available/site.conf +++ b/etc/nginx/sites-available/site.conf @@ -11,7 +11,7 @@ server { location ~ \.php$ { include /etc/nginx/location.d/*.conf; - fastcgi_pass [::]:9000; + fastcgi_pass unix:/run/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; diff --git a/usr/local/etc/php-fpm.d/50-socket.conf b/usr/local/etc/php-fpm.d/50-socket.conf new file mode 100644 index 0000000..081fb58 --- /dev/null +++ b/usr/local/etc/php-fpm.d/50-socket.conf @@ -0,0 +1,5 @@ +[www] +listen = /run/php-fpm.sock +listen.owner = www-data +listen.group = www-data +listen.mode = 0660