NGINX is a feature-rich web server with plenty of customization options. However, if you don’t know the location of its config file, it will be difficult to modify it according to your requirements. Here’s how to find NGINX config file location in CentOS.
NGINX Config File Location in CentOS
The location of NGINX config file differs, depending on the Linux system. In fact, it may include multiple config files.
To begin with, try the following location:
$ sudo vim /etc/nginx/nginx.conf
If you have setup multiple domains/website on a single server, then you might find NGINX config file at:
$ sudo vim /etc/nginx/sites-enabled/default
For example, if you have setup multiple virtual hosts/domains/websites (such as example.com) on your server, you can look for NGINX config file at:
$ sudo vim /etc/nginx/sites-enabled/example.com
If you don’t find NGINX config file at any of the above locations, try the following locations:
$ sudo vim /usr/local/nginx/conf/nginx.conf $ sudo vim /usr/local/etc/nginx/nginx.conf
If you are still unable to find NGINX config file, use the locate command:
$ locate nginx.conf
Once you edit, save and close NGINX config file, you can test it with the command
$ sudo nginx -t
If there are no errors, you can reload NGINX server
$ sudo service nginx reload
That’s it! It’s important to know the location of NGINX config file, since it doesn’t allow you to modify server configuration any other way.