Apache 2.2 “It works” message – vhost and hosts file


I recently switched from using windows to a mac. With windows, you can structure your hosts file like this

127.0.0.1 localhost
127.0.0.1 test.localhost

However, if you do this and you’re on a mac like me and go to test.localhost, you’ll get a “It works!” message no matter how your vhost is configured. The solution is to structure the hosts file for the IP address on a single line like this –

127.0.0.1 localhost test.localhost

Leave a comment

Your email address will not be published. Required fields are marked *