Is there a how-to on virtual hosting with lamp?

Discussion in 'HOWTO-Related Questions' started by Heeter, Aug 21, 2011.

  1. Heeter

    Heeter Member

    Hi all,

    Is there a How-to on setting up virtual hosting on a Ubuntu 11.04 LAMP Server?

    Thanks

    Heeter
     
  2. falko

    falko Super Moderator ISPConfig Developer

  3. Heeter

    Heeter Member

    Thanks Falko,

    I know how to do it on Windows Servers, but a newbie for Linux. I did read that apache documentation, but still have a few questions.

    Do I edit the httpd.conf -or- the apache2.conf file? Do I edit them at all?

    Heeter
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    On Debian based systems like Ubuntu Linux, there is a directory /usr/local/apache2/sites-available/ where you can add the vhost configuration file and then enable the vhost with the command:

    a2ensite yourvhostname
     
  5. Heeter

    Heeter Member

    Hi Till,

    Do I also add the same vhost file to "/usr/local/apache2/sites-enabled/" too? Or does it get added with that command? If I understand correctly, I don't edit either *.conf files, because of that command?

    Thanks


    Heeter
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    You add the file just in the sites-available directory. The command then creates a symlink in the sites-enabled directory which points to the file in sites-available. Afterwards you have to restart or reload apache so that it picks up the new configuration.

    Editing of apache2.conf or httpd.conf is not nescessary, because apache includes the configuration from the sites-enabled directory automatically. The reason for this directory structure instead of editing the .conf files is that you have a saparate config for every vhost and that you can enable them with a2ensite command and disable them with a2dissite command.
     
  7. Heeter

    Heeter Member

    Awesome, Till

    Thanks for the great explanation on this for me!


    Heeter
     
  8. falko

    falko Super Moderator ISPConfig Developer

    One small correction: on Debian/Ubuntu, the directories are
    /etc/apache2/sites-available/
    and
    /etc/apache2/sites-enabled/
     
  9. Heeter

    Heeter Member

    Thanks Falko,

    That is where I found them.

    The virtual hosting is working perfectly. I am a big fan of subdomains, and vhosting really makes it easy for me.


    Thanks guys,

    Heeter
     

Share This Page