Solved

How to Setup Multiple Sites on WAMP

Posted on 2010-09-10
7
582 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
  • 4
  • 2
7 Comments
 
LVL 26

Expert Comment

by:arober11
Comment Utility
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
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 3

Expert Comment

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

Author Comment

by:mrwarejr
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now