RSS Feed

‘Apache’ Category

  1. Multiple Apache websites on Ubuntu

    August 8, 2011 by Helmut

    To set up multiple local websites on Apache, follow this process.

    • 1. Install Apache 2 via synaptic or apt-get (package: apache2).
    • 2. Create the following folders (change the location to your liking) and copy your website files to the “root” folder:
    /home/user/www/website1/
    /home/user/www/website1/root/
    /home/user/www/website1/logs/
    • 3. Create new site configuration file (e.g. “website1″) in /etc/apache2/sites-available/ with the following contents:
    <VirtualHost *:80>
        ServerAdmin website1@localhost
        ServerName website1.dev
        DocumentRoot "/home/user/www/website1/root/"
        ErrorLog /home/user/www/website1/logs/error.log
        CustomLog /home/user/www/website1/logs/access.log combined
    </VirtualHost>
    • 4. Add the following line to your /etc/hosts file:
    127.0.0.1    website1.dev
    • 5. Set permissions so that Apache can access the website by running the following on the command line:
    sudo chgrp -R www-data /home/user/www/website1/
    sudo chmod -R g+w /home/user/www/website1/
    • 6. Enable the new website by running the following on the command line:
    sudo a2ensite website1
    • 7. Restart Apache by running the following on the command line:
    sudo /etc/init.d/apache2 restart
    • 8. Now visit http://website1.dev in your browser to see the website.