I have trying to set up an Apache site to use a folder in my home folder without any success. I exactly followed the steps in this page: https://help.ubuntu.com/community/ApacheMySQLPHP

yet I did not succeed; I keep getting error 403, which says that the server doesn't have permission to access the requested page. I searched forums and many suggested changing the permission of the folder. I went straight away and set the permission to 777, but that didn't solve the problem.

I made another search and somebody gave me a clue, which is that it could be because my home folder is encrypted. I believe this could be the problem, but:

What is the relation between encryption and Apache? I suppose Apache server is requesting the file from the system, rather than trying to access the file bytes!

Is there anyway to solve this problem? I don't want to move the folder to /var/www because I am using this Apache for testing, so I want whatever change I make to be immediately reflected, rather than having to copy files which is error prone.


What's in your error_log?

I don't think home folder encryption should be a problem. I have /var/www/ symlinked to locations in my home folder, and with Options +FollowSymLinks in the site config it works just fine.

Just a couple quick notes - you can sudo chgrp -R www-data <path>; sudo chmod -R g+a <path> instead of setting permissions to 777 - this is a good habit in general and important if you're on a shared host.
I'm not sure what you mean by "I want whatever change I make to be immediately reflected" but I'm guessing you mean keeping a working copy in /home and pointing Apache at /var/www - this isn't necessary/required. You can use ln -s like I've described above or point Apache directly at your home folder as you're trying to do.


Once I wrote this in the next link and I hope this help you, the full thread can be reached by clicking on:

Change the default folder for PHP testing in Linux http://ultimateeditionisrael.freeforums.org/change-the-default-folder-for-php-testing-in-israel-remix-t600.html

However, if we wish to use another local folder for testing in our PHP code, we can change the default folder location used by our php engine to manage these files. This is done using the following procedure:

gksu gedit /etc/apache2/sites-available/default

Provide user password

Then, change all occurrences of "/var/www/" to the folder that we use to test our PHP. (Example: /home/geppettvs/www/ or where appropriate, change "geppettvs" by your local folder.

After that you must restart the computer for the purpose of the changes to take effect. Do not forget also that the files must have the proper file permissions to run properly. (755 is usually sufficient, but some folders [and/or files] may need 777 permissions to read and write them correctly.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.