Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So in the past, I've just had one nginx.conf file. I'd like to separate this out for each domain (right now there's two), but to stay organized in case there's more.

How is this possible to let each domain have it's own .conf file?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Sure.. This is how I do it in the nginx.conf in the http {} block I do

include /etc/nginx/vhosts.d/*.conf;

Then each vhost has its own seperate vhost file. To make it easy they are named like

/etc/nginx/vhosts.d/domain1.com.conf
/etc/nginx/vhosts.d/otherdomain.net.conf

In those files you have your normal server {} blocks for the vhost

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.