0

So here is my problem, I'm running wamp 2.2 on a windows 8.1 machine.

Now, after the install, localhost works fine. When I go to create a virtual host, after setting up the httpd.conf file, if I were to create for example :

<VirtualHost *:80>
   DocumentRoot "c:/wamp/www/test/"
   ServerName test.local
</VirtualHost>

Well this just overrides my localhost. First of all, test.local does not work, and if I were to use localhost it takes me to c:/wamp/www/test/

Anybody have a solution for this ?

PS : I have been setting up my hosts file for windows correctly (addind: 127.0.0.1 test.local), and my 80 port is free (no skype and antivirus turned off).

EDIT: I've also tried with a different port (8080) and the problem continues.

The message I get on my browser is : "Google chrome could not find the website"

0

2 Answers 2

2

If you have virtual hosts set up and you still want to access the localhost webroot, you need to add a vhost for your localhost first

Main host goes away

If you are adding virtual hosts to an existing web server, you must also create a block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.

http://httpd.apache.org/docs/2.0/vhosts/name-based.html

Example (untested):

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot C:\wamp/www
</VirtualHost>

<VirtualHost *:80>
    ServerName otherdomain.local
    DocumentRoot C:\wamp/www/otherdomain
</VirtualHost>
2
  • Yep, that part is done and working. Localhost runs fine, but the second virtual host doesn't. Dec 4, 2013 at 9:33
  • Alright, I don't know what else to tell you since my example was straight from the documentation. Perhaps you could post your current vhosts config including the NameVirtualHost, localhost, and your test domain. You could also look through this page of common misconfigurations: wiki.apache.org/httpd/CommonMisconfigurations
    – Sarah Kemp
    Dec 4, 2013 at 15:54
0

Try this:

<VirtualHost *:80>
DocumentRoot "c:/wamp/www/test" 
ServerName  test.local
ServerAlias test.local
<directory "c:/wamp/www/test">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Require local
</directory>
</VirtualHost>
1
  • Hey ! Thanks for your help. Now I did that, and I just get what I keep getting: Chrome (or others) can't find the page. Dec 3, 2013 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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