Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My environment: Ubuntu 10.10 Desktop Edition

So I am trying to access a file through my localhost and Apache is giving me a 403 error.

On /etc/apache2/apache2.conf, I've added this line :

# wan27 hostel
Include "/home/francoisrv/Ubuntu One/hostel/apache2.conf"

The contents of /home/francoisrv/Ubuntu One/hostel/apache2.conf:

Alias /hostel "/home/francoisrv/Ubuntu One/hostel/"

<Directory "/home/francoisrv/Ubuntu One/hostel/">

DirectoryIndex index.php

Options +FollowSymLinks
AllowOverride All

order deny,allow
deny from all
allow from 127.0.0.0/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>

</Directory>

Then make sure folder is accessible to www-data, on my terminal:

chown -R www-data "/home/francoisrv/Ubuntu One/hostel"

Then restart Apache, Apache does not complain about some misconfiguration

/etc/init.d/apache2 restart
 * Restarting web server apache2                                                                                           ... waiting                                                                                                       [ OK ]

Then, on Chrome, entering address http://localhost/hostel/checkin.php, I get:

403
Forbidden

You don't have permission to access /hostel/checkin.php on this server.

Apache/2.2.16 (Ubuntu) Server at localhost Port 80

The contents of /home/francoisrv/Ubuntu One/hostel/checkin.php:

hola

What am I missing?

share|improve this question
    
What's is apache error log? Also, I don't see virtualhost entry, could you share it? It might be relevant. –  rvs Mar 29 '11 at 7:38
    
Having a look at /var/log/apache2/error.log I see this line: [Tue Mar 29 09:34:15 2011] [error] [client 127.0.0.1] (13)Permission denied: access to /hostel/checkin.php denied. Now a question about the file: it should be /home/francoisrv/Ubuntu One/hostel/checkin.php and not /hostel/chekin.php, but in this case log should show a Not found error instead of Permissions denied ?... –  fabjoa Mar 29 '11 at 7:41
    
@rvs are you talking about the virtual host conf file? –  fabjoa Mar 29 '11 at 7:43
    
Also, I've tried to move the hostel folder somewhere else and same issue :( –  fabjoa Mar 29 '11 at 7:49
    
Now I've moved the hostel folder to the root / and it works ?! Could it be that placing a file in the Ubuntu One folder not the best idea? –  fabjoa Mar 29 '11 at 7:51

3 Answers 3

Have you checked that www-data can read each of the dirs in the path? start at the top level dir and work your way down.

share|improve this answer

Try removing the trailing slashes on your Alias and Directory directives:

Alias /hostel "/home/francoisrv/Ubuntu One/hostel"
<Directory "/home/francoisrv/Ubuntu One/hostel">
share|improve this answer

If it works after moving the hostel folder to another location, the problem may be that you need to escape the space:

<Directory "/home/francoisrv/Ubuntu\ One/hostel/">
 ..
</Directory>
share|improve this answer
    
This isn't really fit as an answer. Please xplain your entire answer rather than just referring to a comment. –  Frands Hansen Oct 6 '12 at 21:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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