Академический Документы
Профессиональный Документы
Культура Документы
Its been long time, was busy with some project works.
1 DocumentRoot "C:/xampp/htdocs/myproject1"
So this will help us to point the localhost directly to myproject1 folder. In other words when you hit hĴp://localhost/ (hĴp://lo-
calhost/) you will get the contents of myproject1. If we had another site to be configured we need to change this Documen-
tRoot again and restart the apache.
New approach:
You can make your localhost to point to different folders on different port numbers. Follow these simple steps:
Step 1: Make your apache to listen to multiple ports. Go to C:\xampp\apache\conf\hĴpd.conf and search for the key word
Listen you can see something like this Listen 80. Now tell your apache to listen to multiple ports, replace that with below con-
tent
1 Listen 80
2 Listen 8001
3 Listen 8002
4 Listen 8003
Step 2: Now go to “C:\xampp\apache\conf\extra\hĴpd-vhosts.conf”, this is the actual player. At the end of the file you can
specify something like this below:
1 ServerAdmin postmaster@dummy-host.localhost
2 DocumentRoot "C:/xampp/htdocs/sample_project"
3 ServerName localhost:8001
4
5 ServerAdmin postmaster@dummy-host.localhost
6 DocumentRoot "C:/xampp/htdocs/personal_site"
7 ServerName localhost:8002
8
9
10 ServerAdmin postmaster@dummy-host.localhost
11 DocumentRoot "C:/xampp/htdocs/myworks"
ServerName localhost:8003
Which tells your apache to take different folders on hiĴing different port numbers. That is when you hit
http://localhost:8001/ (http://localhost:8001/) it will take the contents from sample_project, similarly
http://localhost:8002/ (http://localhost:8002/) will point to your personal_site folder.
http://localhost:8003/ (http://localhost:8003/) will point to your myworks folder.
1 of 8 24-11-2014 17:19
Setup multiple sites on your local machine using XAMPP or Apache | ... http://kuppalli.wordpress.com/2011/01/24/setup-multiple-sites-on-your...
Default hĴp://localhost/ (hĴp://localhost/) will point your Document root folder that you have mentioned in your hĴpd.conf
folder. i.e in my case it is myproject1 foder.
By this we will be able to run 4 different sites on local machine. Hope this helps you people.
Note: You need to restart your apache whenever you change something in hĴpd.conf or hĴpd-vhosts.conf
So now your editor will ask for the password, enter your login password or your root password.
Now Search for listen in and replace the content there with this
1 Listen 80
2 Listen 8001
3 Listen 8002
4 Listen 8003
1 "AcceptMutex flock"
Also search for the and below you should make “AllowOverride” to “All” and above this line add these options “Options In-
dexes FollowSymLinks ExecCGI Includes” i.e
Search for “# Virtual hosts” and remove the comment (#) below this line
i.e
1 # Virtual hosts
2 Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
Finally go to the hĴpd-vhosts.conf file and make sure your folders are configured as said above.
Here is a example:
2 of 8 24-11-2014 17:19
Setup multiple sites on your local machine using XAMPP or Apache | ... http://kuppalli.wordpress.com/2011/01/24/setup-multiple-sites-on-your...
1 ServerAdmin webmaster@dummy-host.example.com
2 DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host.example.com"
3 ServerName dummy-host.example.com
4 ServerAlias www.dummy-host.example.com
5 ErrorLog "logs/dummy-host.example.com-error_log"
6 CustomLog "logs/dummy-host.example.com-access_log" common
7
8 ServerAdmin webmaster@dummy-host2.example.com
9 DocumentRoot "/Users/yourname/Office/clientx/front_end"
10 ServerName localhost:8001
11 ErrorLog "logs/dummy-8001.example.com-error_log"
12 CustomLog "logs/dummy-8001.example.com-access_log" common
13
14
15 ServerAdmin webmaster@dummy-host2.example.com
16 DocumentRoot "/Users/yourname/Office/testing_ground/test"
17 ServerName localhost:8002
18 ErrorLog "logs/dummy-8002.example.com-error_log"
19 CustomLog "logs/dummy-8002.example.com-access_log" common
20
21 ServerAdmin webmaster@dummy-host2.example.com
22 DocumentRoot "/Users/yourname/Office/client1/development"
23 ServerName localhost:8003
24 ErrorLog "logs/dummy-8003.example.com-error_log"
CustomLog "logs/dummy-8003.example.com-access_log" common
32 comments
1. suresh says:
05/13/2010 at 10:19 am
Thanks a lot sridhar, It helped. This is what I was exactly looking out for from ages. Keep posting nice articles and u rock
man.
basically Iv followed the instructions but when I search for hĴp://localhost:8001/ i get a problem loading message. I have
created a folder in the htdocs>sample_project is this correct?
1. expert says:
05/31/2010 at 5:31 pm
Yes, fine.
1. check your hĴpd.conf file for this entry Listen 8001
2. You need to have this in your hĴpd-vhosts.conf file
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot "C:/xampp/htdocs/sample_project"
ServerName localhost:8001
3. You need to restart the apache server if you make any changes.
3. Carolyn says:
06/21/2010 at 12:44 pm
omg your a genius thanks!! I’ve been pounding my head in for the last 3 days trying to sort out this multi-site problem I’ve
been having, this simplified it and actually worked.
3 of 8 24-11-2014 17:19
Setup multiple sites on your local machine using XAMPP or Apache | ... http://kuppalli.wordpress.com/2011/01/24/setup-multiple-sites-on-your...
4. Anant says:
08/09/2010 at 7:53 pm
i have seen that this modification works fine
hĴp://localhost:8002/
hĴp://localhost:8003/ … so on,
but i put Server Alias as
ServerAdmin postmaster@abcdef.localhost
DocumentRoot “D:/phpsites/abcdef”
ServerName localhost:8001
ServerAlias abcdef.localhost
1. expert says:
09/09/2010 at 10:23 pm
hĴp://localhost/ points your apache.
In other words
hĴp://localhost:****/*/*…. points to your apache server.
But what you are trying is defining a new host name that is not related to your apache. Your browser will try to find this
from internet. So you should make a host entry in your host file [C:\WINDOWS\system32\drivers\etc\host]
Means you need to redirect your host name to point to your localhost:8001
DocumentRoot “c:\xampp\htdocs\intranet”
ServerName localhost:8501
Restarted Apache,
but now, when I browse to hĴp://localhost:8501 it goes to hĴp://localhost:85 (= Xampp admin pages)
Jochen
6. Pearl says:
03/30/2011 at 4:20 am
Hi Expert,
Thanks for your blog. It helped me a lot. I have one question. Which approach (traditional or New) do you think is beĴer
and why? Should I create multi-sites by chaning Document Root to point to “C:/” and create two folders for two websites
underneatch “c:/” or should I use different ports? Thanks for your advice
1. expert says:
03/30/2011 at 8:31 am
New approach is beĴer.
You have to put your multiple sites folders in htdocs folder.
7. Carimbo says:
06/26/2011 at 11:35 pm
This didn’t work for me. I followed the instructions step by step and when I tried to restart Apache, it would go to “Not
responding” mode for a few seconds and then it wouldn’t start.
Then I tried seĴing up just port 8001 and 1 virtual host and it started. But then I couldn’t browse the default hĴp://127.1.1.1
site, geĴing a 403 error.
4 of 8 24-11-2014 17:19
Setup multiple sites on your local machine using XAMPP or Apache | ... http://kuppalli.wordpress.com/2011/01/24/setup-multiple-sites-on-your...
:(
1. Carimbo says:
06/27/2011 at 12:09 am
NVM, I solved it, it was a typo on my part.
8. viktoriana says:
07/08/2011 at 3:47 pm
Thanks a million for this tut! But I need some help for the very beginning!
My TextEdit on MBP is NOT asking for a pw, so I cannot save the changes.
Where did I go wrong?
9. Sylvester says:
10/25/2011 at 6:00 pm
Thanks a lot, this helped so much!!! Thanks again!!!
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot “C:/xampp/htdocs/sample_project”
ServerName localhost:8001
to file “C:\xampp\apache\conf\extra\hĴpd-vhosts.conf”, it was not working then i added the following code:
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot “C:/xampp/htdocs/myprojects/mysitename”
ServerName localhost
then it is working but for some directing pages like thank you pages are showing error message that file doesn’t exits.
I gave hĴp://localhost:8001/
“Also search for the and below you should make “AllowOverride” to “All” and above this line add these options “Options
Indexes FollowSymLinks ExecCGI Includes” i.e
1
Options Indexes FollowSymLinks ExecCGI Includes
2
AllowOverride All”
Cheers!
5 of 8 24-11-2014 17:19
Setup multiple sites on your local machine using XAMPP or Apache | ... http://kuppalli.wordpress.com/2011/01/24/setup-multiple-sites-on-your...
1. expert says:
11/22/2012 at 8:58 pm
check your hĴpd-vhosts.conf
1. chris says:
11/22/2012 at 10:51 pm
I can’t see anything wrong in there, I tried swapping the sights around to check but both 8001 & 8002 show the
contents of the second folder. I also tried to change the serverAdmin in case that was confusing it. Here is the
vhosts.conf, in this instance both localhosts show the contents of ccVisions.
ServerAdmin postmaster@shirtsForMike.localhost
DocumentRoot “C:/xampp/htdocs/shirtsForMike”
ServerName localhost:8001
ServerAdmin postmaster@ccVisions.localhost
DocumentRoot “C:/xampp/htdocs/ccVisions”
ServerName localhost:8002
2. Victor says:
11/27/2012 at 1:30 pm
Thanks for the post expert, seems like this is just what i need, though I’m having the same problem as Chris,
whereas all ports are being forwarded to the last most folder in the hĴpd-vhosts.conf file.
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot “C:/Server/xampp/htdocs/ecoe”
ServerName localhost:8001
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot “C:/Server/xampp/htdocs/IPT”
ServerName localhost:8002
What I’ve noticed is that if I put the ecoe parameters at the very boĴom of the file, this leads to errors, so i’m
guessing there must be something wrong in the syntax, but I can’t figure it out.
1. chris says:
12/06/2013 at 11:05 pm
sorry to be the bearer of bad news but over a year later and I never fixed this. I now just write all three then
comment out the 2 that I am not using at any given moment.
6 of 8 24-11-2014 17:19
Setup multiple sites on your local machine using XAMPP or Apache | ... http://kuppalli.wordpress.com/2011/01/24/setup-multiple-sites-on-your...
01/11/2013 at 10:06 pm
What about for a live/remote server- so not using localhost but the ip address – how would you do that? I’ve tried it but
doesn’t seem to be working.
since I’m not connected directly to the Internet I use my local IP instead of my real ex.192.168.1.6
I’ve done this so my three (WordPress and Joomla based) web sites to work:
Listen 80
Listen 8001
Listen 8002
NameVirtualHost 192.168.1.6:8001
NameVirtualHost 192.168.1.6:8002
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot “C:/xampp/htdocs/wsite”
ServerName 192.168.1.6:8001
ServerAlias 192.168.1.6:8001
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot “C:/xampp/htdocs/jsite”
ServerName localhost:8001
ServerAlias localhost:8001
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot “C:/xampp/htdocs/wsite”
ServerName 192.168.1.6:8002
ServerAlias 192.168.1.6:8002
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot “C:/xampp/htdocs/wsite”
ServerName localhost:8002
ServerAlias localhost:8002
P.S. I had full access and with my real IP and the names if the sites outside and inside my server.
127.0.0.2... | 4 | 95 | 129...
etc. (not omiĴing the /, else you get an error on some browsers) & do away with the different
7 of 8 24-11-2014 17:19
Setup multiple sites on your local machine using XAMPP or Apache | ... http://kuppalli.wordpress.com/2011/01/24/setup-multiple-sites-on-your...
ports & stuff. That’s how I roll on my local machine. Instead of trying to remember which port number belongs to which
site, so as to type it correctly in the address bar, (with the ubiquitous
localhost:
thanks for your article. I could use it some time ago to get my test environment working. I wrote a summary on my german
blog about it: hĴp://blog.devilatwork.de/xampp-mehrere-webseiten-mit-hilfe-verschiedener-ports-betreiben/
Follow
8 of 8 24-11-2014 17:19