Skip to content

Commit

Permalink
Merge pull request #22 from bryanlatten/feature-nginx-min-logs
Browse files Browse the repository at this point in the history
Nginx con: adding optional minimal logging
  • Loading branch information
Bryan Latten committed Feb 22, 2016
2 parents ae0a6f9 + 6a205fa commit 64409dc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git/*
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Variable | Example | Description
`SERVER_SENDFILE` | `SERVER_SENDFILE=off` | Allows runtime to specify value of nginx's `sendfile` (default, on)
`SERVER_KEEPALIVE` | `SERVER_KEEPALIVE=30` | Define HTTP 1.1's keepalive timeout
`SERVER_WORKER_CONNECTIONS` | `SERVER_WORKER_CONNECTIONS=2048` | Sets up the number of connections for worker processes
`SERVER_LOG_MINIMAL` | `SERVER_LOG_MINIMAL=1` | Minimize the logging format, appropriate for development environments


### Runtime Commands
Expand Down
2 changes: 2 additions & 0 deletions container/root/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" NGINX_SERVER';

log_format minimal '$request_method $request_uri $status';

error_log /dev/stdout info;
access_log /dev/stdout main;

Expand Down
8 changes: 8 additions & 0 deletions container/root/run.d/10-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ then
echo "[nginx] setting worker connection limit ${SERVER_WORKER_CONNECTIONS}"
sed -i "s/\worker_connections .*;/worker_connections ${SERVER_WORKER_CONNECTIONS};/" $CONF_NGINX_SERVER
fi

if [[ $SERVER_LOG_MINIMAL ]]
then
echo "[nginx] enabling minimal logging"
# Uncomments all gzip handling options
sed -i "s/access_log \/dev\/stdout .*;/access_log \/dev\/stdout minimal;/" $CONF_NGINX_SERVER
fi

0 comments on commit 64409dc

Please sign in to comment.