In my previous post, I explained how to install LAMP on Ubuntu 11.10. This time, let’s delve into configuring virtual hosts. This setup allows you to host multiple independent sites, potentially across different domains.
Choosing a Storage Location for Site Files
First, decide where to store the files for your sites. I use my large /home
partition for this purpose and created a folder at /home/www
.
Setting Up the Environment
Execute the following commands to create necessary directories and set permissions:
Now, let’s create a new virtual host:
Inside this file, paste the following configuration:
After saving the file execute these commands to set up the site:
To access your new site you can either configure DNS to resolve http://example.localhost
or simply modify /etc/hosts
:
Then add:
Save the file and try accessing http://example.localhost
. To view any site errors or warnings, check the `/home/www/log/error.log