Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am developing a site on my local machine and want to point a subdomain of an existing site to my localhost's subdomain. A concrete example:

I have a normal running apache on port 80, and a virtual host on port 8081. I want to point http://dev.google.com to my virtual host.

I've tried adding it to the hosts file, but ports don't work there.

Am using Windows 7 x64

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Remove the virtual host running on port 8081 and make it listen op port 80. Your vhosts should look somewhat like this:

<VirtualHost 172.20.30.40:80>
ServerName google.com
DocumentRoot c:/htdocs/www/main
</VirtualHost>

<VirtualHost 172.20.30.40:80>
ServerName dev.google.com
DocumentRoot c:/htdocs/www/dev
</VirtualHost>
share|improve this answer
    
Ah, I see now, so both should listen to port 80, but they should be name-based hosts. Think I also have to uncomment the line NameVirtualHost *:80 in this case. Thanks! –  Eduard Luca May 14 '12 at 12:01
    
Indeed. You can also use a * instead of the IP, that way your sites can be accessed from all your interfaces. –  Bart De Vos May 14 '12 at 12:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.