Results 1 to 4 of 4

Thread: Rename Virtual Host

  1. #1
    Join Date
    Sep 2008
    Beans
    94

    Rename Virtual Host

    I just recently setup a linode VPS to host a few BS websites, and help me learn more on Ubuntu and CLI, etc.

    Following the Linode guides, I was successful in setting up 4 websites with virtual host naming.

    Now I learned that when I visit the IP address of the VPS, it will get the first site listed alphabetically.

    What is the best way to have the IP address to point to a different site? I think I need to rename the sites-enabled/mysite.com to sites-enabled/00.mysite.com?

    when I do that and reload apache, it throws an error (will have to retry and copy it here if interested).

    Am I on the right track?

  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    10,202
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Rename Virtual Host

    Create a separate configuration file for each virtual host in /etc/apache2/sites-available and use a2ensite to create the needed symlinks to each file in /etc/apache2/sites-enabled. Each site's configuration needs to have a unique "ServerName" directive so that Apache can tell which configuration to use in response to a request. More details here.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    Sep 2008
    Beans
    94

    Re: Rename Virtual Host

    Quote Originally Posted by SeijiSensei View Post
    Create a separate configuration file for each virtual host in /etc/apache2/sites-available and use a2ensite to create the needed symlinks to each file in /etc/apache2/sites-enabled. Each site's configuration needs to have a unique "ServerName" directive so that Apache can tell which configuration to use in response to a request. More details here.
    Thats exactly what I did following the guides from Linode as well. And I have the DNS setup for all them and it works well.

    But now I learned that when I point my actual IP address, it points site mysite01, when I want it retrieve mysite04. I learned this because its alphabetical.

    someone mentioned just renaming the config file in sites-available/mysite04 to 00-mysite04. But than when I reload apache, it gives an error of not finding sites/enabled/mysite04

    I think I need to unlink mysite04 and relink to 00-mysite04?


    EDIT::

    Yes.. It worked by running

    sudo a2dissite mysite04

    and than

    sudo a2ensite 00-mysite04
    Last edited by ptmuldoon; March 13th, 2013 at 06:07 PM.

  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    10,202
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Rename Virtual Host

    If you connect to the server via IP address, you'll get the default host, which is determined by alphabetical order. To make mysite04 be the default host, change the name of that file to something like "0mysite04" so it loads first alphabetically, then restart Apache.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

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
  •