Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Virtual hosting with single domain name

  1. #1
    Join Date
    Oct 2011
    Beans
    9

    Question Virtual hosting with single domain name

    Hello,
    I am currently running three virtual machines (virtual box) all three are running Ubuntnu server 10.04 each hosting different webpages with apache2 and I have one domain name registered. Lets say www.example.com. I want to be able to access each webserver over http by using the name of the server for example www.webserver1.example.com or www.webserver2.example.com. What would be the best way to go about this.

    Thanks,
    -Tim

  2. #2
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,868
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Virtual hosting with single domain name

    If I understand your question, you would like to run multiple web servers with one public ip address.

    First you will want to get name based virtual hosting working with Apache2. The sticky at the top of this forum has the how to listed under HTTP servers. Pick one of your VM's to be the "main" apache server.

    Set up your DNS to point to your main server. Get at least two virtual host's working.

    Once you get that working you will want to setup reverse proxy. This will allow your router to forward all web requests to main server, then main server will "forward" the request to external apache server when other subdomains are requested.

    I created a simple how to for proxy.
    ubuntuforums.org/showthread.php?t=1920715
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  3. #3
    Join Date
    Jun 2009
    Location
    Netherlands
    Beans
    72
    Distro
    Kubuntu

    Re: Virtual hosting with single domain name

    Why not put all 3 servers on one apache server and use virtual hosts?? If that is the only taskt the 3 servers are doing, it would save some resources too when combining them

  4. #4
    Join Date
    Jan 2010
    Location
    Portugal
    Beans
    160
    Distro
    Ubuntu Development Release

    Re: Virtual hosting with single domain name

    Yep, you can use all three site in the same machine.

    But there's some times when we need to have some different machines, for different reasons.

    You need to configure VirtualHosts as a proxy for the others servers.


    http://httpd.apache.org/docs/2.0/vho...les.html#proxy
    Javali
    Administração e Desenvolvimento de Sistemas Informáticos, Lda.
    Open Source Systems / SugarCRM / Alfresco / Drupal / Openbravo
    http://www.javali.pt info at javali.pt

  5. #5
    Join Date
    May 2011
    Beans
    159
    Distro
    Xubuntu

    Re: Virtual hosting with single domain name

    I have similar setup. Multiple VPS, multiple sites per VPS. Single IP, multiple (sub)domain names. Look into pound. http://www.apsis.ch/pound

    I have dedicated VPS that runs pound to handle all http requests.

  6. #6
    Join Date
    Oct 2011
    Beans
    9

    Talking Re: Virtual hosting with single domain name

    Thank you all so much for your reply. This is something I am dabbling at for work to see if we could provide VPS to some of our clients, which is the main reason they would have to be separate vm instances. volkswagner and HugoSerrano I will try out both of your recommendations and let everyone know how it works out.

    Thanks again everybody,
    -Tim

  7. #7
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Virtual hosting with single domain name

    Quote Originally Posted by time4e View Post
    Hello,
    I am currently running three virtual machines (virtual box) all three are running Ubuntnu server 10.04 each hosting different webpages with apache2 and I have one domain name registered. Lets say www.example.com. I want to be able to access each webserver over http by using the name of the server for example www.webserver1.example.com or www.webserver2.example.com. What would be the best way to go about this.
    If you have control over the DNS for example.com, and the servers have separate fixed IP addresses, you only need to change the DNS records for the domain:

    Code:
    @   IN SOA example.com. root.example.com. (
           [stuff]
           )
    
    [more stuff]
    
    www.webserver1     IN    A   ip.of.webserver.1
    www.webserver2     IN    A   ip.of.webserver.2
    If the webservers are configured to serve requests as www.webserver1.example.com and www.webserver2.example.com, that should be all you need.

  8. #8
    Join Date
    Oct 2011
    Beans
    9

    Re: Virtual hosting with single domain name

    SeijiSensei,
    I am using no-ip.com to manage my dns for the domain, do I need to configure the dns record on no-ip's control panel or can i edit it on the vm that i have the dns updater for no-ip?

  9. #9
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Virtual hosting with single domain name

    I don't know. I run my own DNS servers. The entries have to be publicly visible however you configure it.

    I'd actually create an A record for server.example.com and a CNAME for www.server.example.com. In Apache, you can designate server.example.com as the ServerName and www.server.example.com as the ServerAlias. Then you can advertise server.example.com, but still accept requests from people who think all web sites begin with "www".

  10. #10
    Join Date
    Oct 2011
    Beans
    9

    Angry Re: Virtual hosting with single domain name

    All,
    Thanks again for the replies, but I have been at this for a month now with no results. Again I have multiple webservers behind one domain name/ip address. My domain lookup is provided by no-ip.com, I have setup two Apache web servers server1 and server2. I would like my external users to be able to access there appropriate web server buy typing server1.example.com or server2.example.com in a web browser. Pound seems like it would be great if I was hosting mutiple websites on one webserver but this is not my case. I need some solution that would enable me to port forward 80 to a server and have that server redirect to the requested server or a better dns solution. any more ideas? Perhaps pound could do this? can't find any decent docs on it. Setting up cnames in my noip control panel works but only internally. Any ideas, tips, tricks for me?

    Thanks,
    -Tim

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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