简体   繁体   中英

set up virtual host in wamp server to run multiple website

I am running virtual host with Wamp server for a website called dev.gamenomad.com. Everytime I go to localhost, the page will redirect to dev.gamenomad.com in C:\\wamp\\www\\dev.gamenomad.com instead of the traditional Wamp server page where you can access each project.

I want to have the welcome page so that I can run other project when I run Wamp server. How can I set up my virtual host for dev.gamenomad.com without affecting the welcome page of Wamp server?

my "host" file

127.0.0.1       localhost
127.0.0.1       dev.gamenomad.com

http-vhost.config

<VirtualHost *:80>
    ServerAdmin bomboom@devgamenomad.localhost
    DocumentRoot "C:\wamp\www\dev.gamenomad.com\public"
    ServerName dev.gamenomad.com
    ServerAlias dev.gamenomad.com
    ErrorLog "logs/dev.gamenomad.com-error.log"
    CustomLog "logs/dev.gamenomad.com-access.log" common
</VirtualHost>
<Directory C:\wamp\www\dev.gamenomad.com>
   Order Deny,Allow   
   Allow from all 
</Directory>

my www folder is in C:\\wamp\\ , and my Wamp server listen to port 80

wamp traditional welcome page 在此处输入图片说明

You need to create one more virtual host of localhost too.

<VirtualHost *:80>
    ServerAdmin bomboom@devgamenomad.localhost
    DocumentRoot "C:\wamp\"
    ServerName localhost
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
</VirtualHost>
<Directory C:\wamp\>
   Order Deny,Allow   
   Allow from all 
</Directory>

Adding a new virtual host, should be enough. like SuryaElite suggested with the only addition of the www folder included in the vhost and much simpler.

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot "C:\wamp\www"
</VirtualHost>
<Directory "C:\wamp\www">
  Order Deny,Allow   
  Allow from all 
</Directory>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM