Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Setup Multiple Sites on WAMP

Posted on 2010-09-10
7
Medium Priority
?
600 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

688 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