Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the order of the config file for NGINX

Tags:

nginx

I have the following config files and locations:

etc/ngnix/nginix.conf
var/etc/nginx/sites-available/myproject
etc/ngnix/conf.d/default.conf
etc/ngnix/conf.d/web.conf

I'm confused regarding each conf file role, rules, when to use one or another, are they loaded one after another, or just one, are directives overwriting ?

like image 889
user3541631 Avatar asked Apr 30 '18 20:04

user3541631


1 Answers

The nginx configuration file is called nginx.conf and on most systems is located at etc/nginx/nginx.conf.

nginx.conf may optionally contain include statements to read parts of the configuration from other files. See this document for more. Read your nginx.conf file to identify which files and directories are sourced and in which context and which order.

Some distributions are delivered with an nginx.conf file that sources additional files from directories such as /conf.d/ and /sites-enabled/.

There is also a convention on some distributions to symlink files between /sites-available/ and /sites-enabled/.

The nginx -T command (uppercase T) is useful to list the entire configuration across all the included files.

like image 117
Richard Smith Avatar answered Sep 21 '22 00:09

Richard Smith