Nginx 1 cheatsheet

Nginx 1: Control and diagnostics

8 common Nginx 1 tasks.

Check the Nginx version

Print the version. Use -V to include the build options and modules.

nginx -v

Test the configuration

Check the syntax of the configuration files. Always run this before reloading.

sudo nginx -t

Reload without downtime

Apply a new configuration gracefully.

sudo nginx -s reload

Reload with systemd

Reload the service on systems that use systemd.

sudo systemctl reload nginx

Restart Nginx

Stop and start the service, dropping open connections.

sudo systemctl restart nginx

Print the full configuration

Test and dump the merged configuration, including all includes.

sudo nginx -T

Follow the error log

Watch errors as they happen.

sudo tail -f /var/log/nginx/error.log

Follow the access log

Watch requests as they arrive.

sudo tail -f /var/log/nginx/access.log

Was this page helpful?