Link to home
Start Free TrialLog in
Avatar of mrwarejr
mrwarejrFlag for United States of America

asked on

How to Setup Multiple Sites on WAMP

I have an issue here.  I am trying to setup multiple sites on a WAMP server.  This way we can setup and test multiple sites while they are being developed.  I have no problem setting WAMP up for one site then moving it to the next site, but it would be much more efficient to have all the sites up at the same time without only being able to work on one at a time.  Here is what I have done.

1. WAMP is setup fine as I can change the httpd.conf to change from one site to the next.
2. I have modified the httpd.conf to uncomment the following
    # Virtual hosts
    Include conf/extra/httpd-vhosts.conf
3. I have modified the httpd-vhosts.conf file to add in one site to start as follows
    <VirtualHost *:80>
        ServerAdmin user@domain.com
        DocumentRoot "d:/wamp/www/sub1"
        ServerName sub1.domain.com
        ErrorLog "logs/sub1-error.log"
        CustomLog "logs/sub1-access.log" common
    </VirtualHost>

I then restarted WAMP and when I browse to the site I get the error in the attached image.  I have dns setup properly, since if I just host one site at a time it works just fine.  Please help as I need to get about 4 sites up and running for the developers to work on. User generated image
Avatar of arober11
arober11
Flag of United Kingdom of Great Britain and Northern Ireland image

If you haven't gor a local DNS entry for  "sub1.domain.com", then on the PC your browsing from have you added a

C:\Windows\System32\drivers\etc\hosts   entry for "sub1.domain.com"


e.g.

11.22.33.44   www.domain.com sub1.domain.com  www.other.domain.com  another.domain.com


Note: Change the IP 11.22.33.44  to that of your test Apache server.
Avatar of mrwarejr

ASKER

Yes I added the entries to all my domains in the host file already:

192.168.102.9   sub1.domain.com
192.168.102.9   sub2.domain.com
192.168.102.9   sub3.domain.com
192.168.102.9   sub4.domain.com
On the WAMP server, check the Apache is listening on 192.168.102.9:80  by opening a CMD window and typing

netstat -a

You should see a LISTENING entry, if all is well e.g.

 TCP  192.168.102.9:80   xxxxxxxxxx   LISTENING

On the PC open a CMD prompt and type:

ping -a sub1.domain.com -n 1
ping -a sub2.domain.com -n 1
ping -a sub3.domain.com -n 1
ping -a sub4.domain.com -n 1


If all ok type:

telnet sub1.domain.com 80
GET /

If all that works your browser should be fine, unless you have an HTTP Proxy configured.
Avatar of sethisaurabh
sethisaurabh

This URL will help you regarding virtual host.
http://cesaric.com/?p=255
The link didn't help at all.  I have eveything configured that way and it does not work.

I was able to get all information using netstat -a except when it came to the telnet portion.  When I tried to telnet I received a Connect Failed on port 80.  The ping and netstat worked though  On the netstat I did not see a listening on 80 though.  If I uncomment the vhosts and just use the httpd.conf with a single site I am able to browse to the site though.  Not sure why it is not working on port 80 with virtual hosts when it works with single sites.  The only problem with single sites is my developers can only work on one site then I need to change the httpd.conf to point at the next site.  It is very unproductive that way.  Any other ideas.
I found out somewhat where the issue is.  Not sure how to fix though.

Once I make the modifications to the httpd.conf and vhosts.conf the icon in the bottom turns yellow upon restart and port 80 is not used. Once I comment out the vhosts portion of the httpd.conf file the service starts just fine. Not sure what is causing that issue, but that is obviously where the problem lies.
ASKER CERTIFIED SOLUTION
Avatar of mrwarejr
mrwarejr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial