Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which nginx-config file is enabled, /etc/nginx/conf.d/default.conf or /etc/nginx/nginx.conf?

Tags:

nginx

centos6

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.

like image 295
Derek Avatar asked Mar 03 '14 09:03

Derek


People also ask

What is the default nginx config file?

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 .

What is ETC nginx conf D default conf?

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.

How do I know which config file for nginx?

Every NGINX configuration file will be found in the /etc/nginx/ directory, with the main configuration file located in /etc/nginx/nginx. conf .

Where is default nginx config?

All NGINX configuration files are located in the /etc/nginx/ directory. The primary configuration file is /etc/nginx/nginx. conf .


1 Answers

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.

like image 111
Mohammad AbuShady Avatar answered Sep 18 '22 17:09

Mohammad AbuShady