Where is the Nginx Config File Located?

Last updated on | one reply

The Nginx configuration file can be in multiple locations and can also include several other config files.

To edit the nginx configuration file, first try here.

sudo nano /etc/nginx/nginx.conf

nginx.conf may also include some other config files, for example:

sudo nano /etc/nginx/sites-enabled/default

If you followed one of our guides for setting up multiple domains for Nginx, the config may be located here (where example.com is your own domain)

sudo nano /etc/nginx/sites-enabled/example.com

If you can’t find Nginx config in the above location, try one of these:

sudo nano /usr/local/nginx/conf/nginx.conf
sudo nano /usr/local/etc/nginx/nginx.conf

If you still can’t find it, try locate.

locate nginx.conf

To save file and exit in nano, press CTRL + X, press Y and then press ENTER)

To check that the Nginx config file is valid after saving.

sudo nginx -t

If valid, reload Nginx service.

sudo service nginx reload

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

1 reply

Leave a reply

Your email address will not be published. Required fields are marked *