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 need help configuring virtual hosts in apache on Windows.

I have the following in my hosts file:

127.0.0.1 ebdowns

in httpd-vhosts.conf I have made the following entries:

NameVirtualHost *:80

<VirtualHost 127.0.0.1> 
    DocumentRoot "C:\wamp\www\"
    ServerName localhost
</VirtualHost>

<VirtualHost www.ebdowns> 
    DocumentRoot "C:\wamp\www\ebdowns"
    ServerName www.ebdowns
    ServerAlias www.ebdowns
    <Directory "C:\wamp\www\ebdowns">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

I try to restart apache but with these entries it won't restart. If I remove the first block the server restarts but then when I enter www.ebdowns into my browser it can't find the site located there

Can anyone help let me know where I've gone wrong please

Thanks

share|improve this question

closed as off topic by Iain Apr 10 '13 at 6:26

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
The syntax of your config is not correct. Read the virtualhost documentation. It has a few good examples. –  Krist van Besien Apr 10 '13 at 4:20
    
What is the error message that you get when Apache fails to start ? –  Iain Apr 10 '13 at 6:20
    
Your question is off topic for Serverfault because it doesn't appear to relate to servers/networking or desktop infrastructure in a professional environment. It may be on topic for Superuser but please search their site for similar questions that may already have the answer you're looking for. –  Iain Apr 10 '13 at 6:26

2 Answers 2

The IP:PORT pattern in your NameVirtualHost directive must be identical to the one you use in your VirtualHost blocks.

So in your case:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName Localhost
# first virtual host directives
</VirtualHost>
<VirtualHost *:80>
    ServerName ebdowns
    ServerAlias www.ebdowns
# second virtual host directives
</VirtualHost>

It's all explained in the documentastion. You should read it.

share|improve this answer

the hosts file should contain:

127.0.0.1 ebdowns www.ebdowns
share|improve this answer

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