Home » Linux & Netbooks » Apache2 Configuration

Apache2 Configuration

After much frustration trying to get Apache to run corectly under EeeBuntu (Ubuntu based Linux distro) I finally discovered that the solution was actually a simple one.

Apache ran fine, and MySQL, PHPMyAdmin and PHP5 were all installed and working correctly.  However it was not possible to place a web site into a folder location within my /home/myuser/www folder.

The steps to solve this were actually very simple:

1 – create the www folder and create a dummy index.htm page to test the site with.

2 – Create a new Virtual Host by using terminal to issue the following commands – changing your site name and user folder as necessary.

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite

gksudo gedit /etc/apache2/sites-available/mysite

change DocumentRoot line point to /home/myuser/www

change Directory line to point to /home/myuser/www

3 -  Ensure the user account folder can be accessed by Apache by changing the permissions.

chmod +x /home/myuser

4 – Secure Apache

gksudo gedit /etc/apache2/ports.conf

change the Listen line to read

Listen 127.0.0.1:80

5 – Enable your new site usinge:

sudo a2ensite mysite

6 – Change folder permissions to ensure the home folder and the user home folder can be browsed by other users, else Apache will return messages about files not found.

7 - Restart Apache

sudo /etc/init.d/apache2 restart

8 - Test your new site http://localhost/