Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions images/common/init_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ elif [ "$MODULE_NAME" = 'nginx' ]; then
if [ "$NGINX_CUSTOM_FILE" = 'True' ]; then
nginx -g 'daemon off;'
fi
NGINX_EVENTS_BLOCK=$(printf "%b" "${NGINX_EVENTS_BLOCK:-}")
export NGINX_EVENTS_BLOCK
export NGINX_WORKER_RLIMIT_NOFILE="${NGINX_WORKER_RLIMIT_NOFILE:-__UNSET__}"
envsubst </etc/nginx/nginx.template.conf >/etc/nginx/nginx.conf
# Remove incomplete worker_rlimit_nofile directives if env var is unset or empty
sed -i '/__UNSET__/d; /^worker_rlimit_nofile *$/d; /^[[:space:]]*$/d' /etc/nginx/nginx.conf
envsubst_create_config /etc/nginx/openwisp.internal.template.conf internal INTERNAL
if [ "$SSL_CERT_MODE" = 'Yes' ]; then
nginx_prod
Expand Down
4 changes: 4 additions & 0 deletions images/openwisp_nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ ENV MODULE_NAME=nginx \
NGINX_GZIP_MIN_LENGTH=1000 \
NGINX_GZIP_TYPES='text/plain image/svg+xml application/json application/javascript text/xml text/css application/xml application/x-font-ttf font/opentype' \
NGINX_CUSTOM_FILE=False \
NGINX_WORKER_PROCESSES=1 \
NGINX_WORKER_CONNECTIONS=1024 \
NGINX_WORKER_RLIMIT_NOFILE=__UNSET__ \
NGINX_EVENTS_BLOCK='' \
NINGX_REAL_REMOTE_ADDR='$real_ip' \
NGINX_SSL_PORT=443 \
# USWGI pass_port
Expand Down
6 changes: 4 additions & 2 deletions images/openwisp_nginx/nginx.template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
# all openwisp server blocks.

user nginx;
worker_processes 1;
worker_processes ${NGINX_WORKER_PROCESSES};
worker_rlimit_nofile ${NGINX_WORKER_RLIMIT_NOFILE};

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
worker_connections ${NGINX_WORKER_CONNECTIONS};
${NGINX_EVENTS_BLOCK}
}

http {
Expand Down