Why does Apache2 serve a subdomain when given an IP?
March 14, 2009 12:41 AM
I have a domain hosted on a VPS running CentOS5. Whenever I enter http://my-vps-ip in my browser, I get redirected to http://subdomain.mysite.com.
My limited Google-fu is no match for this particular problem, so I'm hoping the folks at AskMeFi can tell me how I should setup Apache so that http://my-vps-ip goes to http://mysite.com and not the subdomain?
Extracts from the httpd.conf file:
Many thanks!
Extracts from the httpd.conf file:
ServerName mysite.com ... UseCanonicalName Offconf file defining the subdomain:
<virtualhost *:80> ServerName subdomain.mysite.com DocumentRoot /var/www/subdomain ErrorLog /var/log/httpd/subdomain_mysite_com-error.log CustomLog /var/log/httpd/subdomain_mysite-access.log combined <directory> Options Indexes FollowSymLinks AllowOverride AuthConfig FileInfo Indexes Limit Order allow,deny Allow from all </directory> < /virtualhost>Also, FWIW - currently the rDNS lookup on my VPS IP goes to ns1.mysite.com.
Many thanks!
Also, you can use _default_ so that you don't have to pay attention to the order of your vhosts.
posted by rhizome at 10:25 AM on March 14, 2009
posted by rhizome at 10:25 AM on March 14, 2009
I tried adding the _default_ option to the Virtual Host entry in the httpd.conf but I think the "Include conf.d/*.conf line" is still taking precedence.
In any case, I moved the Virtual Host entry for mysite.com to the same conf file as the sub-domain and added the _default_ option. After that, it started working!
hades - thanks for the tip on the ServerAlias.
posted by your mildly obsessive average geek at 2:51 AM on March 15, 2009
In any case, I moved the Virtual Host entry for mysite.com to the same conf file as the sub-domain and added the _default_ option. After that, it started working!
hades - thanks for the tip on the ServerAlias.
posted by your mildly obsessive average geek at 2:51 AM on March 15, 2009
This thread is closed to new comments.
posted by your mildly obsessive average geek at 2:42 AM on March 14, 2009