Where is the Nginx Config File Located?

Last updated on

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
1 Star2 Stars3 Stars4 Stars5 Stars 4.75 (4 votes)

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

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

1 reply

avatar
  Subscribe  
newest oldest
Notify of
Joshua Pinter
Guest
Joshua Pinter
Joshua Pinter
10 months ago

locate nginx.conf

THANK YOU!