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

Thread: Virtual servers with Apache

  1. #1
    Join Date
    Nov 2008
    Beans
    50

    Virtual servers with Apache

    I need help fellas.
    Virtual servers, apache2, webmin.

    Right I got two sites in two different directories on my server. The idea is to map them to two different hostnames. Both on http port 80.

    xxx.com will go to /www/xxx/index.htm
    yyy.com will go to /www/yyy/index.htm

    using webmin, i create a virtual server or shall i say two virtual servers and map them. Is it that straight forward?

    Someone help please?

  2. #2
    Join Date
    Sep 2007
    Location
    Olympia, Washington
    Beans
    548
    Distro
    Ubuntu

    Re: Virtual servers with Apache

    Do you mean Virtual hosting? You will need a static ip. Follow this post http://buckycomputing.net/blog/hosti...with-1-server/
    ~Mark
    http://nwlinux.com - tech blog

  3. #3
    Join Date
    Sep 2008
    Beans
    31

    Re: Virtual servers with Apache

    If your DNS entries for xxx.com and yyy.com are configured correctly, I believe it will work in the fashion you want. I don't know about using webmin, but Apache's documents on virtual hosts can be found here:
    http://httpd.apache.org/docs/2.0/vhosts/examples.html

  4. #4
    Join Date
    Oct 2006
    Location
    Pittsburgh, PA
    Beans
    69
    Distro
    Ubuntu

    Re: Virtual servers with Apache

    What you want isn't too hard. As I think others have eluded too, your DNS provider should be mapped so that this.com and that.com both point to the IP of the server that will be hosting the two domains. Then you just gotta do the Apache config.

    Ok, so your main apache2.conf you don't usually need to touch. instead, go into /etc/apache2/sites-available/

    in that folder, you will need to create a config file for each vHost. so create /etc/apache2/sites-available/this

    Code:
    <VirtualHost *:80>
       ServerName this.com
       DocumentRoot /var/www/this/
    </VirtualHost>
    And make a config file for that.com, with the same syntax.

    now you just need to enable the site so do a

    Code:
    a2ensite this
    and restart apache

    Code:
    /etc/init.d/apache2 restart
    The End

  5. #5
    Join Date
    Nov 2008
    Beans
    50

    Re: Virtual servers with Apache

    Quote Originally Posted by tlsarles View Post
    What you want isn't too hard. As I think others have eluded too, your DNS provider should be mapped so that this.com and that.com both point to the IP of the server that will be hosting the two domains. Then you just gotta do the Apache config.

    Ok, so your main apache2.conf you don't usually need to touch. instead, go into /etc/apache2/sites-available/

    in that folder, you will need to create a config file for each vHost. so create /etc/apache2/sites-available/this

    Code:
    <VirtualHost *:80>
       ServerName this.com
       DocumentRoot /var/www/this/
    </VirtualHost>
    And make a config file for that.com, with the same syntax.

    now you just need to enable the site so do a

    Code:
    a2ensite this
    and restart apache

    Code:
    /etc/init.d/apache2 restart
    The End
    Thank you all for your help. Sorted with the instructions quoted above. You my friend are a star.
    Now how do i disable a site i.e the opposite of a2ensite this

  6. #6
    Join Date
    Sep 2008
    Beans
    31

    Re: Virtual servers with Apache

    my enabled sites are symbolic links to the configuration files in /etc/apache2/sites-available - i just remove the symlink in sites-enabled that points to the configuration file for the site I wish to disable, and restart apache.

    the companion to a2ensite is a2dissite, which is a script that does this automatically.

    man a2ensite for more information
    Last edited by neoanderthal; January 17th, 2010 at 03:08 AM.

  7. #7
    Join Date
    Feb 2009
    Location
    Texas
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Virtual servers with Apache

    neo,

    I faced a similar issue months ago. I was able to install two sites with 1 IP. Take a look on this thread that I created.

    http://ubuntuforums.org/showthread.php?t=1249354

  8. #8
    Join Date
    Nov 2008
    Beans
    50

    Re: Virtual servers with Apache

    OK that was me bieng a ****. Forgot all about the man command. All works good though guys. Thanks you all very much

  9. #9
    Join Date
    Oct 2006
    Location
    Pittsburgh, PA
    Beans
    69
    Distro
    Ubuntu

    Re: Virtual servers with Apache

    a2dissite or something like that......

  10. #10
    Join Date
    Jul 2007
    Location
    The Internet
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Virtual servers with Apache

    Quote Originally Posted by tlsarles View Post
    now you just need to enable the site so do a

    Code:
    a2ensite this
    I usually just make a link in sites-enabled (with an appropriately-numbers xxx- prefix).

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
  •