I'm hitting the most frustrating problem with the devlopment environment on my Mac at work (OS X 10.6.6, Apache 2.2.15, PHP 5.3.3 - all default installs with very little modification). Last night I started working on a new website, I added a virtual host and added a few domains to /etc/hosts
to resolve to my local machine.
My hosts file entry looks like this:
10.10.11.199 dev.example.com
10.10.11.199 example.com
And my virtual host looks like this:
<VirtualHost *>
DocumentRoot "/Volumes/Websites/ExampleClient/example.com/source"
ServerName example.com
ServerAlias *.example.com
</VirtualHost>
I'd like to think it's something stupid I've done, but the annoying thing is it was working last night! The only thing that's changed since then is that I restarted my machine this morning. The domain example.com
works as expected, but dev.example.com
doesn't, the request drops into the default virtual host at /Volumes/Websites/Personal/Rowan Manning
.
Things I've tried:
- Explicitly setting
dev.example.com
as a virtual host ServerName with no aliases - Restarting apache with
sudo apachectl restart;
- Restarting apache with
sudo apachectl stop; sudo apachectl start;
- Restarting my Mac (again)
- Checking that the
/Volumes/Websites/ExampleClient/example.com/source
directory is OK - Checking the permissions for
/Volumes/Websites/ExampleClient/example.com/source
- Checking that I'm editing the right virtual hosts file by forcing it to error
I'm stuck! Any ideas?
Edit (21st March 11):
The problem seems to have resolved itself over the weekend. I haven't changed anything, yet again... I'm completely mystified but glad it's working!