Nobita
Nobita

Reputation: 23713

Apache symlinks give 403 Forbidden

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?

Upvotes: 5

Views: 2659

Answers (2)

Jan Mares
Jan Mares

Reputation: 805

It can be problem with linux permissions or it can be AllowOverride used in Directory directive of virtual host config for apache.

Upvotes: 0

Jivan
Jivan

Reputation: 23068

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.

Upvotes: 4

Related Questions