Docker-nginx: Adding --with-debug

Created on 11 Dec 2015  路  5Comments  路  Source: nginxinc/docker-nginx

error_log /var/log/nginx/error.log debug; doesn't work because --with-debug apparently wasn't used in the debian package:

root@52df12b24fec:/etc/nginx/conf.d# nginx -V 
configure arguments: --prefix=/etc/nginx 
--sbin-path=/usr/sbin/nginx 
--conf-path=/etc/nginx/nginx.conf 
--error-log-path=/var/log/nginx/error.log 
--http-log-path=/var/log/nginx/access.log 
--pid-path=/var/run/nginx.pid 
--lock-path=/var/run/nginx.lock 
--http-client-body-temp-path=/var/cache/nginx/client_temp 
--http-proxy-temp-path=/var/cache/nginx/proxy_temp 
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp 
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp 
--http-scgi-temp-path=/var/cache/nginx/scgi_temp 
--user=nginx --group=nginx 
--with-http_ssl_module 
--with-http_realip_module 
--with-http_addition_module 
--with-http_sub_module 
--with-http_dav_module 
--with-http_flv_module 
--with-http_mp4_module 
--with-http_gunzip_module 
--with-http_gzip_static_module 
--with-http_random_index_module 
--with-http_secure_link_module 
--with-http_stub_status_module 
--with-http_auth_request_module 
--with-threads 
--with-stream 
--with-stream_ssl_module 
--with-mail 
--with-mail_ssl_module 
--with-file-aio 
--with-http_v2_module 
--with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' 
--with-ld-opt='-Wl,-z,relro -Wl,--as-needed' 
--with-ipv6

Is it possible to enable debug logs otherwise?

Most helpful comment

@jsdevel, you can use the nginx-debug binary provided since nginx:1.9.8.

Something like:

$ docker run -d nginx:latest 'nginx-debug' '-g' 'daemon off;'

should work.

All 5 comments

@jsdevel, you can use the nginx-debug binary provided since nginx:1.9.8.

Something like:

$ docker run -d nginx:latest 'nginx-debug' '-g' 'daemon off;'

should work.

ahh sweet! Would it be helpful to document this in the README?

@jsdevel I would love if someone documents it.

~Did anyone actually get this working? I've followed the updated documentation and added command: [nginx-debug, -g, 'daemon off;'] to the service definition in my docker-compose.yml, but the container still dies immediately with the error nginx: [emerg] unknown log format "debug" in /etc/nginx/conf.d/default.conf. I've tried it using both the most recent nginx image and the 1.9.8 image.~

Never mind. I added the debug flag to the access_log directive as well as the error_log directive. That doesn't make any sense, does it? 馃槪

Ah that was my error too I think.

Was this page helpful?
0 / 5 - 0 ratings