Test Nginx Config File
It’s been a while since we’ve posted an article. Mainly because we were using our own website as a guinea pig to test whether or not posting fresh content really mattered with Google. Short answer, it does; long answer, it does and does not. That’s another topic. We really want to show you how to test your nginx config file.
Nginx Test Server Config
nginx -c /etc/nginx/nginx.conf -t
sudo nginx -c /etc/nginx/nginx.conf -t
What this line of code does, and this of course assumes you know how to use the command line because otherwise, why would you need to know any of this? When you don’t know how to use the command line, you can use easier hosting. When you do know how to use the command line, you Google this article and we tell you. Anyway, back to the explantation.
The -c part says to use the config file located at /etc/nginx/nginx.conf. In the edge case where your nginx config is located somewhere else, you would of course place the path to your actual config file right there.
The -t part is what tells the service nginx to test the config. The output of this will vary based on what your issues are, or it’ll tell you everything is okay.
The beauty of this is that you are able to test your configs and revert before reloading or restarting and causing major problems.
Need help with your Nginx config?
Send us an email or comment on the form. Should you need professional help, there would of course be a monetary investment. But it would of course be worth it if we save your website.