harnessing Nginx multiple configuration files

August 28, 2014 1.9k views

I have enough understanding on Nginx configuration file concepts and syntax. I also get that using multiple configuration files has architectural advantages, i.e. global configuration that never changes can live in it's own file, individual domain specific configurations can be linked in sites-enabled, etc.

What I don't understand is how these multiple config files come together to work as a whole. Nginx.org does not cover this subject as far as I could tell. I found one tutorial here that uses "include" calls to reference other configuration files but so far I have been unable to make this example work without Nginx reporting an error when I reload the configuration.

Does anyone know of a manual that addresses the use of multiple configuration files?

2 Answers

All the individual vhost config files get included with a line in the main config file:

include /etc/nginx/sites-enabled/*;


Whats the nginx error you get?

Thanks for that link. I think I may have had some nonsensical include statements from copying and pasting other people's sample configurations. I need to sit down and map out what I need to accomplish on paper first.

Have another answer? Share your knowledge.