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

I recently installed Nginx onto an Ubuntu 10.04 machine to try to learn how to use it over Apache. I installed using aptitude. I correctly set up a virtual host under /etc/nginx/sites-available and created a symlink to /etc/nginx/sites-enabled and deleted the defaults there.

The site was working fine until I manually edited the aptitude sources file and performed an upgrade, now I'm noticing that the virtual hosts I assigned are being overwritten by a new configuration file in /etc/nginx/conf.d. How can I revert to detecting the virtual hosts from the /sites-enabled directory? Why did the update change where nginx detects virtual hosts?

share|improve this question
1  
The main nginx config file is /etc/nginx/nginx.conf - one of the bottom lines file says to include all .conf files in /etc/nginx/conf.d. The update added the new conf file in /etc/nginx/conf.d, but (probably) did not overwrite your main config. Check the main nginx.conf file to confirm, and rename the file in /etc/nginx/conf.d/ (possibly default.conf) to disable it. –  cyberx86 Nov 21 '11 at 21:29
    
@cyberx86 Arrg, I should have thought to check the main conf file. I figured an update wouldn't have overwritten the main configuration file, and is awfully silly to have just assumed I wanted a different one. I'd love to mark your answer as the answer, could you post so I can close off this question? –  Whetstone Nov 21 '11 at 21:32
    
I just had this happen to me a couple days ago actually - switched to using the nginx repository instead of building my own RPMs, and server wouldn't start - the problem was a bit more obvious on my setup though since it displayed a setting I knew I hadn't set. –  cyberx86 Nov 21 '11 at 23:25

1 Answer 1

up vote 1 down vote accepted

The main nginx config file is /etc/nginx/nginx.conf. There is a line at the bottom that reads:

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

While this is part of the default config (and has been for some versions), the more recent versions move the default server from this main config file to /etc/nginx/conf.d/default.conf.

The most likely scenario is that a new file (default.conf) was added to your conf.d directory, and automatically included in your configuration. (Usually, updates will not overwrite existing config files, but they will add any new config files - which your existing config just may be set to include).

Check the main nginx.conf file to confirm, and rename (or delete) the new file in /etc/nginx/conf.d/ (possibly default.conf) to disable it.

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.