Test Nginx Configuration

To test your Nginx configuration files, run the following command:

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

It will indicate if your configuration file syntax is correct.

Configuration Check Failure

[email protected]:/etc/nginx/sites-enabled# nginx -c /etc/nginx/nginx.conf -t
nginx: [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/test01:2
nginx: configuration file /etc/nginx/nginx.conf test failed

Configuration Check Success

[email protected]:/etc/nginx/sites-enabled# nginx -c /etc/nginx/nginx.conf -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Leave a Reply