From 3caf170c7df9c8edef2c1da673e038ee46bd0692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 14 Mar 2018 09:06:28 +0100 Subject: [PATCH] Add readonly-fs compatible configuration for nginx --- Dockerfile | 12 +++++++----- nginx/nginx.conf | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 nginx/nginx.conf diff --git a/Dockerfile b/Dockerfile index bd9a738..32e4a9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,7 +55,8 @@ ENV PYTHONPATH="/usr/local/lib/" \ TFW_SUPERVISOR_HTTP_URI="http://localhost:${TFW_SUPERVISOR_HTTP_PORT}" \ TFW_SUPERVISORD_CONF="/etc/supervisor/supervisord.conf" \ TFW_SUPERVISORD_COMPONENTS="/etc/supervisor/conf" \ - TFW_NGINX_CONF="/etc/nginx/sites-enabled/default" \ + TFW_NGINX_CONF="/etc/nginx/nginx.conf" \ + TFW_NGINX_DEFAULT="/etc/nginx/sites-enabled/default" \ TFW_NGINX_COMPONENTS="/etc/nginx/components" \ TFW_LIB_DIR="/usr/local/lib/" \ TFW_CONTROLLER_DIR="/srv/controller" \ @@ -73,11 +74,12 @@ RUN echo "shopt -s cmdhist\n" \ 'PROMPT_COMMAND="history -a"\n' \ >> /home/${AVATAO_USER}/.bashrc -COPY nginx/default.conf ${TFW_NGINX_CONF} +COPY nginx/nginx.conf ${TFW_NGINX_CONF} +COPY nginx/default.conf ${TFW_NGINX_DEFAULT} COPY nginx/components/ ${TFW_NGINX_COMPONENTS} -RUN chown -R ${AVATAO_USER} /var/log/nginx /var/lib/nginx &&\ - sed -i 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf &&\ - for f in "${TFW_NGINX_CONF}" ${TFW_NGINX_COMPONENTS}/*.conf; do \ +RUN chown -R ${AVATAO_USER} /var/log/nginx /var/lib/nginx &&\ + sed -i 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf &&\ + for f in "${TFW_NGINX_DEFAULT}" ${TFW_NGINX_COMPONENTS}/*.conf; do \ envsubst "$(printenv | cut -d= -f1 | grep TFW_ | sed -e 's/^/$/g')" < $f > $f~ && mv $f~ $f ;\ done diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..5d1e5ec --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,24 @@ +worker_processes auto; +pid /tmp/nginx.pid; + +events +{ + worker_connections 1024; +} + +http +{ + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + access_log /dev/stdout; + error_log /dev/stderr; + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +}