I have some projects in /home/novito/Projects that I want Apache to be able to serve.
I have done the following:
cd /var/www
sudo ln -s /home/novito/Projects/testphp testphp
When I visit localhost/testphp/index.php
, I get a
You don't have permission to access /testphp/prova.php on this server.
I have tried doing the following:
cd /home/novito/Projects
sudo chmod 755 testphp
But I still have the same problem. When doing ls -la, I see the following info for testphp directory:
drwxr-xr-x 2 novito novito
What am I doing wrong?
Currently, you just tested the permission for testphp directory.
The complete path has to be executable by Apache. So you have to do this:
$ cd /
$ sudo chmod o+x home
$ sudo chmod o+x home/novito
$ sudo chmod o+x home/novito/Projects
$ sudo chmod o+x home/novito/Projects/testphp
Or in a single line:
$ sudo chmod o+x /home /home/novito /home/novito/Projects /home/novito/Projects/testphp
This will give Apache (and everybody else) the right permissions.
A more comprehensive answer can be found here on AskUbuntu. Worth reading.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With