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

root@proxy:/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

root@proxy:/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

2 thoughts on “Test Nginx Configuration

  1. This is great news to us. Thank you so much for sharing your article. may i’ll recommend your blog and let my friends know about your post?

Leave a Reply