Today I Learned

hashrocket A Hashrocket project

Test Your Nginx Configuration

Nginx misconfiguration can produce vague messages like these:

$ sudo service nginx reload
 * Reloading nginx configuration nginx
   [fail]

Turn up the verbosity with these flags:

$ nginx -c /etc/nginx/nginx.conf -t

The -c flag indicates a certain configuration file will follow; the -t flag tells Nginx to test our configuration. This produces much more useful errors like this:

nginx: [emerg] unknown directive "erver_name" in /etc/nginx/sites-enabled/default:3
nginx: configuration file /etc/nginx/nginx.conf test failed

erver_name should be server_name– with these flags we now have an actionable error message.

Nginx switches docs