Find the answer to your Linux question:
Results 1 to 7 of 7
Hey everyone, I am building a webserver that will have multiple websites on it. I am only familiar with building a server that supports one site. I was curious how ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2005
    Posts
    26

    Multiple Sites on One Server


    Hey everyone,

    I am building a webserver that will have multiple websites on it. I am only familiar with building a server that supports one site. I was curious how do I setup my server to be able to have a bunch of sites one it?

    My friend who I will be using as a Co-Lo hosting has a computer setup with DNS so I wouldn't need DNS on my server. I was curious though how do I setup my server to be able to handle multiple sites? Is it called Virtual Hosts?

    Any information would be greatly appreciated!

    Thanks in advance for your help


    Wes

  2. #2
    Linux Newbie deek's Avatar
    Join Date
    Mar 2005
    Location
    Fort Wayne, IN
    Posts
    248
    Yep, virtual hosts will do all of that for you. You will have to create DNS entries for each separate website, also.

    all the virutal host stuff can go at the bottom of your httpd.conf file. Make sure you also create a virtual host for your current site, so if you have 3 sites, that only differ by domain name and location on your hard drive, then you will need three separate virutal host "blocks" at the end of your file.

    there is good documentation on apache's website to use virtual hosts. Since they are all on the same machine, you will have the same IP but you will want to differentiate the virtual hosts by domain name...

    Hope that works for ya!
    Join the Open Source Revolution. Support GNU/Linux.

    Find me at: www.deeksworld.com
    Registered GNU/Linux User #395777

  3. #3
    Just Joined!
    Join Date
    Apr 2005
    Posts
    26
    Great sounds good.

    One last question though. Considering I don't have DNS running on my server how would I test the website. If I am accessing the server with http://192.168.0.2/ for my current website, how would I do it with a virtual hosts, would I have to specify a port?

    Thanks again

  4. #4
    Linux Newbie deek's Avatar
    Join Date
    Mar 2005
    Location
    Fort Wayne, IN
    Posts
    248
    Yeah, I suppose you would have to specify a port in your virtual hosts directive. Then, to test, you would have to put that port in your URL to make sure it is going to where it should.

    Once you do get the DNS parts hooked up, then you will have to go back and change those virtual host directives to domain names.
    Join the Open Source Revolution. Support GNU/Linux.

    Find me at: www.deeksworld.com
    Registered GNU/Linux User #395777

  5. #5
    Just Joined!
    Join Date
    Apr 2005
    Posts
    26
    Alright. Sounds good.

    Thanks for your help

  6. #6
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,879
    Quote Originally Posted by wfernley
    Great sounds good.

    One last question though. Considering I don't have DNS running on my server how would I test the website. If I am accessing the server with http://192.168.0.2/ for my current website, how would I do it with a virtual hosts, would I have to specify a port?

    Thanks again
    You could do it with entries in your hosts file on the machine you're testing from. Apache resolves the virtual hosts based on the URL address you supply in the http:// request, so you want to have the requests formed correctly.

    Beware if you do this that you dont want to put SSL on any of the web pages; it's a pain-in-the-ass for virtual hosts.

  7. #7
    Linux Newbie
    Join Date
    Apr 2003
    Location
    Pontypridd, Wales
    Posts
    104
    yeh, ssl don't work with virtual hosts.

    If you need to do this, what I do is run 2 instances of apache. One listens on port 80 and uses name based virtual hosts, and the other listens on 443 for ssl traffic.

    You can also use ip based virtual hosting.

    There's lots of documentation available, have a good google.

    By the way, like Roxoff said, use your hosts file to resolve the name to the ip address of your computer.
    \"One World, One Web, One Program.\" -- Advertisement for Internet Explorer.
    \"Ein Volk, Ein Reich, Ein Fuehrer.\" -- Adolf Hitler.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •