Solved

How to Setup Multiple Sites on WAMP

Posted on 2010-09-10
7
597 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
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 look for a specific file type in a local or remote server directory using PHP.

622 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