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.

As far as I know, the only way to define what the default vhost site is for a server is to make sure the vhost's .conf is loaded before the others:

000-defaultsite.conf
othersite.com.conf
anothersite.com.conf

Is there any way to alter what the default site is without resorting to renaming .conf files and restarting apache every time?

I'm doing some testing for a web server configuration. During the testing phase, I will need to change the default vhost for the server several times. Renaming and restarting every time will get tedious.

share|improve this question
2  
Why do you need to change the default vhost? –  Matthew Ife Nov 9 '11 at 22:25
    
It seems like your config is using Include, which will load things in alphabetical order. The first virtual host defined will be the default unless you specify a default –  Zoredache Nov 9 '11 at 22:36
    
I need to change the default vhost because the server hosts multiple sites on it. In order to test those sites on the new server without making external DNS changes I can only directly access the IP address of the server. Accessing the IP address of a server will take you to the default vhost site. So the only way to test each site is to change which site is the default site. That way when you access the server via IP address, the site you need to test is the site that appears. –  Jakobud Nov 9 '11 at 22:55
    
Why not add an entry to your hosts file? –  quanta Nov 10 '11 at 7:06
    
I ended up adding them to my local host file. For some reason I didn't consider this before but it worked great. Now I can specify the sites by name instead of IP address. No need to change the default site. Quanta if you want to properly answer the question, I will give you credit. –  Jakobud Nov 10 '11 at 15:48
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.