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

Well,

I know how to do virtual hosts, but on windows it looks harder to get what i want to.

<VirtualHost *:80>
    ServerAdmin admin@domaindev.com
    DocumentRoot "C:/wamp/www/domaindev_com/public"
    ServerName domaindev.com
    ServerAlias *.domaindev.com
    ErrorLog "logs/domaindev_com-error.log"
    CustomLog "logs/domaindev_com-access.log" common
</VirtualHost>

And my hosts file:

# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.

127.0.0.1      localhost
192.168.0.1    domaindev.com
192.168.0.1    www.domaindev.com

C:\Documents and Settings\B>ping domaindev.com

Pinging domaindev.com [192.168.0.1] with 32 bytes of data:

Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Documents and Settings\B>ping www.domaindev.com

Pinging www.domaindev.com [192.168.0.1] with 32 bytes of data:

Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128
Reply from 192.168.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

So it looks like it works. But when i try to use the www.domaindev.com in my browser i get a time out or a dns failure...

Any ideas ? Is the ServerAlias option wrong ?

EDIT: Only the domaindev.com is working

share|improve this question

4 Answers 4

up vote 2 down vote accepted

Have you tested changing the ServerAlias directive to the absolute URL www.domaindev.com and trying that?

Your browser may have also cached the failed DNS request and hasn't tried it again - usually killing all browser sessions will help with that.

share|improve this answer

These configuration files are on a server, right? And the browser you're trying to load it up in is on your personal machine, not the server? Because, see, when you put 192.168.0.1 www.domaindev.com in the hosts file, it only makes it resolve on that machine, not any other. Try putting it in your workstation's hosts file too.

share|improve this answer
    
Both server and browser are on the same computer. –  Boris Guéry Jun 1 '09 at 22:59

Can you access the site via domaindev.com? via the ip address? If you can't it's not a resolution problem but an apache config/startup problem as the server is not running.

share|improve this answer
    
I'm able to access to domaindev.com (and ip address) –  Boris Guéry Jun 2 '09 at 10:52
    
hmm, this shouldn't make a difference but i would try to adjust your hosts file to have 1 192 line so i would read '192.168.0.1 domaindev.com www.domaindev.com' also i would try putting domaindev.com and wwww.domaindev.com on the 127.0.0.1 line once again shouldn't make a difference –  Zypher Jun 2 '09 at 13:12

Do you have any active proxy configuration in your webbrowser? Try to deactivate the proxy. Sometimes the command "ipconfig /flushdns" exectued in a command prompt helps.

Have you already tried to connect to your website with "domaindev.com"? If this works than you have to change your ServerAlias directive to an fqdn. http://httpd.apache.org/docs/2.0/mod/core.html#serveralias

share|improve this answer
    
ServerName directive is required as the fqdn - the ServerAlias is not. –  Mike Fiedler Jun 2 '09 at 12:07

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.