View Full Version : [ubuntu] Apache ServerName Directive Quirk
December 16th, 2008, 04:28 PM
I'm having trouble setting up a virtualhost for one of my domains: ash.ms. www.ash.ms works fine, but for some reason ash.ms is just not working.
The following works fine:
The following just show me the default page:
With the next one, www.ash.ms shows the right page, but ash.ms still shows the default Apache page.
I'm using Apache2 and a completely updated 8.04. I'm just wondering is there something blatant I've missed, or is this a big of some kind. It's driving me nuts.
Any help would be appreciated.
December 17th, 2008, 12:29 AM
Both www.ash.ms (http://www.ash.ms) and ash.ms (http://ash.ms) both resolve to the same page/site ('Ashley Kyd') for me.
Perhaps you need to check (clear) your browser cache?
December 17th, 2008, 05:20 AM
I should have mentioned that this is using internal DNS. if you set your HOSTS file to point these to 188.8.131.52, you can see the server I'm working with.
The following is the configuration I'm using.
http://pastebin.com/m4fe21563 ← Default config, pretty standard.
http://pastebin.com/m10e2693f ← All virtualhosts catted together.
December 17th, 2008, 09:05 AM
Oooookay, I've worked out what the problem is — the server name is ash.ms, so for some reason Apache's overriding my virtualhost and pointing ash.ms to the main/default site instead.
I changed the machine's hostname and just reloaded the config to find that ash.ms was working, but it'd knocked out kyd.com.au. That's really annoying.
December 17th, 2008, 07:31 PM
The config you've posted doesn't quite match up.
I've added manual mappings for www.ash.ms (http://www.ash.ms) and ash.ms to 184.108.40.206 and requesting www.ash.ms (http://www.ash.ms) results in a 301 permanent redirect to ash.ms. The delivered document (index.html) is zero bytes in length.
Your config makes no mention of redirects (other than for www.kyd.com.au (http://www.kyd.com.au)) so either you've changed it since posting or you're confused about which config is responsible for this site.
Incidentally, your machine name has nothing to do with Apache's operation if you use Servername directives.
December 18th, 2008, 11:19 AM
Sorry, you're right. I've updated the config since, so that I'm not serving up duplicate content.
It does seems like the system's hostname is affecting the virtualhosts though. It started as "ash.ms" which was the affected domain. I changed the hostname to "kyd.com.au" as my webhost had set the default other one, and after a config reload kyd.com.au started doing the same thing whereas ash.ms was fine.
It's a bit weird, and it's messed up my directory structure somewhat, but I can work with it. :)
Edit: I did post something like this yesterday, but for some reason the system ate it. :-/
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.