Nginx configuration file locations


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.

  1. Once you've created and admin user, log into your Dedicated Server and navigate to the following directory:
  2. Use sudo to view the directory contents:
    [server]$ sudo ls -la
  3. Enter your password when prompted.
    You'll see the nginx.conf file listed.
  4. Edit the file using sudo:
    [server]$ sudo nano nginx.conf
  5. Save and close the file and return to your shell.

Local configuration files

In the following examples, username would be your Shell user and your website.

Nginx hard codes an include path for every domain, as seen in the following example:


This /home/username/nginx/ 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/ folders do not exist by default. You must create them manually by running the following commands under your username:

[server]$ mkdir -p nginx/

To clarify, you'll now have two directories your domain uses:

  • Your actual web directory (aka document root)
  • Your nginx/ directory 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:

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?