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
To save file and exit in nano, press
Y and then press
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.
p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.