Discussion in 'HOWTO-Related Questions' started by Heeter, Aug 21, 2011.
Is there a How-to on setting up virtual hosting on a Ubuntu 11.04 LAMP Server?
Take a look here: http://httpd.apache.org/docs/2.0/vhosts/name-based.html
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?
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:
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?
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.
Thanks for the great explanation on this for me!
One small correction: on Debian/Ubuntu, the directories are
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.
Separate names with a comma.