How to enable apache2 to serve pages from your home directory on Ubuntu 14.04
How to enable apache2 to serve pages from your home directory on Ubuntu 14.04
If you want to do some development on a site, and work with the development files on you home directory, here is a solution on how to set up apache2 to allow you to do that.
- Set up a conf file for your site on your home folder, eg mysite.conf under /etc/apache2/conf-available/mysite.conf
- Run ln -s /etc/apache2/conf-available/mysite.conf /etc/apache2/conf-enabled/mysite.conf to make a link in the conf-enabled folder.
- Edit the mysite.conf file to look something like this:
-
Alias /neotrac /home/me/mysite
<Directory /home/me/mysite>
DirectoryIndex index.php
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
deny from all
allow from 127.0.0.1/255.0.0.0 ::1/128
# allow from all
<IfModule mod_php5.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
#php_value include_path .
</IfModule>
<IfModule !mod_php5.c>
<IfModule mod_actions.c>
<IfModule mod_cgi.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php
</IfModule>
<IfModule mod_cgid.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php
</IfModule>
</IfModule>
</IfModule>
</Directory> - Run sudo a2enmod userdir
- Change the group for the files to www-data by running sudo chmod -R www-data /home/me/mysite
- restart apache2: sudo service apache2 restart
- And viola! That did it for me. i hope it is useful to you to.
Let me know if anything does not work out or if a have missed some steps.
No comments