This article lists the different locations for Nginx configuration files.
This article contains information/examples using root/sudo/admin users. If you require sudo/admin access, you must upgrade to a Dedicated server.
The nginx.conf file
The main config file can only be seen or edited if you're using an admin user on a Dedicated server.
- Once you've created and admin user, log into your Dedicated server and navigate to the following directory:
- Use 'sudo' to view the directory contents:
[server]$ sudo ls -la
- Enter your password when prompted.
- You'll see the nginx.conf file listed.
- Edit the file using 'sudo':
[server]$ sudo nano nginx.conf
- Save and close the file and return to your shell.
Local configuration files
Nginx hard codes an include path for every domain, as seen in the following example:
/home/username/nginx/example.com directory is the only place you should load any .conf file you want your actual site to use. Additionally, any file ending in .conf is inserted into the server block of the nginx.conf file.
The /nginx/example.com folders do not exist by default. You must create them manually by running the following commands under your username:
[server]$ mkdir -p nginx/example.com
To clarify, you'll now have two directories your domain uses:
- Your actual web directory (aka document root)
nginx/example.comdirectory where ALL config files should be placed
Examples of .conf files
View the following articles for examples on what a custom .conf file would look like for your site: