↑ ↓ select, Enter open, Esc close

Check the nginx configuration for syntax errors

root@server
nginx -t

Reads /etc/nginx/nginx.conf including all includes and reports syntax is ok and test is successful, or the faulty file with its line number. The running service is left untouched. Run it after every manual change.

Note: Warnings such as conflicting server name are not syntax errors, but they point to duplicate server_name entries, of which only one takes effect.

Also searched as

  • nginx config test command
  • nginx won't start after config change
  • nginx syntax is ok check
  • find nginx configuration error

Related one-liners

All in nginx

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.