harnessing Nginx multiple configuration files

  • Posted August 28, 2014

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. 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?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.

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?