Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx: why multiple conf files?

Tags:

nginx

There are multiple nginx conf files on single installation. Here is what I found:

  1. /opt/nginx/conf/nginx.conf
  2. /etc/nginx/nginx.conf
  3. /etc/nginx/sites-available/default
  4. more in /etc/nginx/conf.d
  5. more in /etc/nginx/sites-available

What's the use of those multiple conf files? What is going to happen if there are conflict? Which one is the master copy?

like image 339
user938363 Avatar asked Mar 21 '17 01:03

user938363


People also ask

Can nginx have multiple config files?

There are multiple nginx conf files on single installation. Here is what I found: /opt/nginx/conf/nginx.

Does nginx whitespace matter?

For most of your nginx. conf this won't hurt anything.

What is the purpose of nginx conf?

It is used to set global options that affect how Nginx handles connections at a general level. There can only be a single events context defined within the Nginx configuration.

Where do nginx config files go?

Every NGINX configuration file will be found in the /etc/nginx/ directory, with the main configuration file located in /etc/nginx/nginx. conf . NGINX configuration options are known as “directives”: these are arranged into groups, known interchangeably as blocks or contexts .


1 Answers

Start with /etc/nginx/nginx.conf, all of the other files are included into it. See this document for details.

Use nginx -T to see the complete configuration as nginx sees it.

like image 54
Richard Smith Avatar answered Jan 04 '23 11:01

Richard Smith