How do I set up nginx-debug on Ubuntu 14.04 server?

Apparently reading a guide can be interpreted in several ways. Worth to mention here is that not everything written in fixed-width blocks are commands, and the bread text in between those blocks is essential to read, too, in order to know the context. The fixed-width block could represent

  • commands (service nginx stop)
  • partial commands (./configure --with-debug ...)
  • configuration file content (error_log /path/to/log debug;)
  • output of a command (configure arguments: --with-debug ... from nginx -V)
  • script (while $log->writer != ngx_log_memory_writer) or source code
  • something malicious you could copy-paste to your command line with this attitude.

Now that you've learned how to read all manuals, guides and tutorials, everything you need is in the NGINX debugging log guide:

Pre-built Linux packages provide out-of-the-box support for debugging log with the nginx-debug binary (1.9.8) which can be run using commands

service nginx stop
service nginx-debug start

and then set the debug level. Note that redefining the log without also specifying the debug level will disable the debugging log. In the example below, redefining the log on the server level disables the debugging log for this server:

error_log /path/to/log debug;

http {
    server {
        error_log /path/to/log;
        ...

This means that with the packages from NGINX repository (since version 1.9.8) you'd have the nginx-debug service, but nginx-common in trusty doesn't seem to provide it as it's build to the default binary. All you need to do is to modify your configuration.

Now seek for the error_log directives through your configuration (/etc/nginx/nginx.conf). With syntax error_log file [level]; you should add (or alter) the level debug, the file being your path. If there's no level specified, default level error gets used.


Nowhere. The nginx version provided by Ubuntu already is compiled with the debug option. The steps shown in that guide are meant to be used when compiling your own version of nginx, which you definitely should not do if you have to ask the question you asked.