There are two config files around, /etc/nginx/conf.d/default.conf
and /etc/nginx/nginx.conf
, but which one is enabled? I am running CentOS6.4 and nginx/1.0.15.
By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .
conf . /etc/nginx/conf. d/default. conf is used to configure the default virtual host. For this you can also use sites-available and sites-enabled . You can find more details at a blog entry from digital ocean How To Configure The Nginx Web Server On a Virtual Private Server.
Every NGINX configuration file will be found in the /etc/nginx/ directory, with the main configuration file located in /etc/nginx/nginx. conf .
All NGINX configuration files are located in the /etc/nginx/ directory. The primary configuration file is /etc/nginx/nginx. conf .
Technically, nginx.conf
is all that matters, if you define every thing inside there it would still work, but to keep things organized, they use include
, somewhere at the end of nginx.conf
you'll see include /etc/nginx/conf.d/*
and in some distros you'll also find include /etc/nginx/sites-enabled/*
this is a convention to keep things organized, you create your server blocks in that conf.d
or sites-enabled
folder and it would be included here as if it's written in the nginx.conf
file.
Of course you can add your own include lines there normally and create your own new conf folder that would be auto included.
TIP: These files are included in alphabetical order, you need to keep that in mind if you don't specify any server as default_server
, because first one would be the default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With