Mamaduka
Mamaduka

Reputation: 163

Virtual Host with WAMP

I'm using Wamp 2.2, edited conf/extra/httpd-vhosts.conf edited this file to add VirtualHosts , but when I un-commented line in httpd.conf to include httpd-vhosts.conf file, after restarting Wamp doesn't starts. If I revert changes is works fine.

Any ideas why is this happening?

This is code I'm using in httpd-vhost.conf:

<VirtualHost *>
    ServerAdmin [email protected]
    DocumentRoot "C:/wamp/www" # change this line with your htdocs folder
    ServerName localhost
    ServerAlias localhost
    <Directory "C:/wamp/www">
        Options Indexes FollowSymLinks Includes ExecCGI
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

# WooCommerce Multisite
<VirtualHost dev.lo>
    ServerAdmin [email protected]
    DocumentRoot "C:/wamp/www/dev"
    ServerName dev.lo
    ServerAlias dev.lo
    <Directory "C:/wamp/www/dev">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Thanks

George

Edit

As Andreas Hagen suggested, I run Apache via httpd.exe.

First error was wrong parameter for DocumentRoot, as appears comment like was taken as second parameter, when DocumentRoot accepts only one.

Then I got warning: [warn] NameVirtualHost *:80 has no VirtualHosts. Did a quick search and found very helpful question - https://serverfault.com/questions/1405/apache-2-startup-warning-namevirtualhost-80-has-no-virtualhosts

Upvotes: 3

Views: 14230

Answers (3)

Dhaval
Dhaval

Reputation: 875

Go to C:/drive and choose wamp folder

and go to C:\wamp\bin\apache\Apache2.4.4\conf and choose httpd.conf file.

Edit with notepad and go to 58 line number

change Listen 80 and replace Listen 8181 Save file and restart your Apache server

Now check url such like this localhost:8181

I have used this hop you will be success.

Upvotes: 0

Yuki Kutsuya
Yuki Kutsuya

Reputation: 4088

Open your hosts file (\WINDOWS\system32\drivers\etc\hosts). Add this line to the bottom:

127.0.0.1        test

This will tell your computer that any url that contains test will be routed to 127.0.0.1 (localhost).

Now open httpd.conf and add this to the very bottom of the file:

NameVirtualHost *:80  
<VirtualHost *:80>  
    DocumentRoot "c:/wamp/www/myfirstsite/"  
    ServerName testsite  
</VirtualHost> 

Now restart apache and navigate to: http://test/ (you may have to restart your browser for the changes to take effect.)

Hope this works.

Upvotes: 3

Andreas Hagen
Andreas Hagen

Reputation: 2345

Probably some bad config in vhosts file. Try to start apache from commandline so you get the error output. That will help you identify your problem.

Upvotes: 5

Related Questions