Nick
Nick

Reputation: 1340

apache 000-default virtual host

I see that there's the 000-default virtual host and I left it. I created a new file and link for mysite.com and it works, but not how I want it to. I'm wondering, does anyone know if I need to delete or if I shouldn't delete the 000-default vh?

For some reason if to go to http://example.com, it takes me to the 000-default site, but if I go to http://www.example.com (note the www) it takes me to the correct place. Why is there a difference?

This is my site's vh file:

#NameVirtualHost *
<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName mysite.com
        ServerAlias www.mysite.com *.mysite.com
        DocumentRoot /home/nick/www/mysite.com

        ErrorLog /var/log/apache2/mysite.com/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel info

        CustomLog /var/log/apache2/mysite.com/access.log common
        ServerSignature On

</VirtualHost>

Upvotes: 5

Views: 25325

Answers (2)

Emre Hasegeli
Emre Hasegeli

Reputation: 61

Using "_default_" virtual host may solve the problem: http://httpd.apache.org/docs/2.0/vhosts/examples.html#default

It is good practise to change default virtual host configuration to "_default_" after creating another virtual host configuration.

Upvotes: 4

vartec
vartec

Reputation: 134551

Configured like that, there is no need for default VH. Now, why mysite.com takes you to default? That's a good question, if your configuration is exactly as you've copied, you have restarted the server, then it shouldn't.

Upvotes: 0

Related Questions