Nginx configuration files structure
Where do I put specific domain configuration files on an nginx server? I've seen a lot of conflicting information. Does it belong in the sites-enabled folder? If so, do I put it in the already created (via symlink) www.mysite.com file? Or do I create a www.mysite.com.conf file? Or do I put the www.mysite.com.conf in the conf.d directory? I'm just trying to add some media specific caching rules particular to one website hosted on my nginx server (so not in the nginx.conf file). I just want to make this config file particular to a website. I'm unsure of where to place the config file and placing it conf.d under www.mywebsite.com.conf or in the sites-enabled under the same name has not worked. Thanks.
Nginx packaging changed : the conf.d
folder was used in old packages, sites-enabled
/ sites-available
is used now with sites-available
directory containing actual vhosts configurations and sites-enabled
the symlinks to sites-available
vhosts you want to activate.
So a typical structure would now be :
nginx
├── nginx.conf
├── sites-available
│ ├── mysite1
│ └── mysite2
└── sites-enabled
└── mysite1 -> ../sites-available/mysite1
However, you have the liberty to do it whatever way you want, and even use none of these structures. Simply put the relevant include
directive(s) in your main configuration file.