Solved

How to Setup Multiple Sites on WAMP

Posted on 2010-09-10
7
594 Views
Last Modified: 2012-05-10
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. Error
0
Comment
Question by:mrwarejr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 26

Expert Comment

by:arober11
ID: 33649049
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.
0
 

Author Comment

by:mrwarejr
ID: 33649775
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
0
 
LVL 26

Expert Comment

by:arober11
ID: 33652234
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.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 3

Expert Comment

by:sethisaurabh
ID: 33660059
This URL will help you regarding virtual host.
http://cesaric.com/?p=255
0
 

Author Comment

by:mrwarejr
ID: 33662511
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.
0
 

Author Comment

by:mrwarejr
ID: 33676465
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.
0
 

Accepted Solution

by:
mrwarejr earned 0 total points
ID: 33676839
I just figured it out. The vhosts file was fine, but the problem was in my httpd.conf file. I figured out (By reviewing  the log file) that I just needed the top line in the httpd.conf file (as shown below) and when I uncommented the other ones that was causing the service to not start. I have since removed all lines below that are not needed. Now I can work directly from the vhosts.conf file.

DocumentRoot "d:/wamp/www/"
#DocumentRoot "d:/wamp/www/Site1"
#DocumentRoot "d:/wamp/www/Site2"
#DocumentRoot "d:/wamp/www/Site3"
#DocumentRoot "d:/wamp/www/Site4"

<Directory "d:/wamp/www/">
#<Directory "d:/wamp/www/Site1">
#<Directory "d:/wamp/www/Site2">
#<Directory "d:/wamp/www/Site3">
#<Directory "d:/wamp/www/Site4">
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question