Have two websites running on the same server - using XAMPP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Have two websites running on the same server - using XAMPP

Postby MichaelBoyeOlsen » 09. March 2010 16:26

Hi all.
Sorry, I'm a bit of a noob to all this :)

I have two domains:
domain1
domain2

Is it possible to have both domains running on the same server?
Like this:
domain1 points to http://www.domain1.com
domaint2 points to http://www.domain2.com

- I know it is possible in IIS and WampServer.
But I don't know how to do it here.

Hope you guys can help me.

Best Regards,
Michael
MichaelBoyeOlsen
 
Posts: 3
Joined: 09. March 2010 16:18

Re: Have two websites running on the same server - using XAMPP

Postby Stepke-DSL » 09. March 2010 16:54

Hi,

Sure, it is possible to have 2 domains on the same server.
You have to look for virtualhosts...

Best Regards,
Stepke
Stepke-DSL
 
Posts: 313
Joined: 12. July 2007 16:08
Operating System: Win XP Pro SP3 + SuSe Linux

Re: Have two websites running on the same server - using XAMPP

Postby MichaelBoyeOlsen » 09. March 2010 17:00

Great - I'll do that - thanks :)
MichaelBoyeOlsen
 
Posts: 3
Joined: 09. March 2010 16:18

Re: Have two websites running on the same server - using XAMPP

Postby MichaelBoyeOlsen » 10. March 2010 22:27

Hi again.
I have tried to search for it, but I can't find anything about how to make it happen.
Could anyone tell me how to do it, step by step?
I want this webpage: www.mydomain.com
to point in to this folder: C:\xampp\htdocs\mydomain

Is there anything else you need to guide me?

- Again, sorry I'm a bit of a noob to all this.
Hope someone can help.

Best Regards,
Michael
MichaelBoyeOlsen
 
Posts: 3
Joined: 09. March 2010 16:18

Re: Have two websites running on the same server - using XAMPP

Postby CraigS » 11. March 2010 01:12

Open up httpd-vhosts.conf under /xampp/apache/conf/extra
Change:
Code: Select all
#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80

#
# VirtualHost example:
#

To:
Code: Select all
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
#


Then scroll down a bit you will see:
Code: Select all
##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host.localhost
    ##DocumentRoot "C:/xampppy/xampp/htdocs/dummy-host.localhost"
    ##ServerName dummy-host.localhost
    ##ServerAlias www.dummy-host.localhost
    ##ErrorLog "logs/dummy-host.localhost-error.log"
    ##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host2.localhost
    ##DocumentRoot "C:/xampppy/xampp/htdocs/dummy-host2.localhost"
    ##ServerName dummy-host2.localhost
    ##ServerAlias www.dummy-host2.localhost
    ##ErrorLog "logs/dummy-host2.localhost-error.log"
    ##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>


Here is an example of mine i use on my server (you can add this at the end of the file):
Code: Select all
<VirtualHost *:80>
    DocumentRoot C:\xampp\htdocs\craigsbe
    ServerName CraigS.be
    ServerAlias www.CraigS.be
</VirtualHost>


In the above you can see ServerName and Server Alias, what these do is tell apache to 'listen' for requests for Craigs.be and http://www.Craigs.be

Edit: To have this work, you MUST have the domain name actually point to the server, the apache server gets the domain info from the browser; Also if you check the documentation, the first entry in this table will be the default site that will load up if you do not specify a name (such as entering in the servers ip address) (For example i have craigs1.be and craigs2.be listed under the same ip address, when i go to the ip address of the server it will load craigs1.be 's site, since again it is listed first.


Hope this helps
Craig S
User avatar
CraigS
 
Posts: 16
Joined: 10. March 2010 23:37
Location: Wisconsin, USA


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 25 guests