Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a folder name public that I set up Apache to serve files out of, for some reason I was getting a 403 with the error message:

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

My solution was to create another folder (test) alongside it and use that to serve files out of.

What I don't understand is why if the permissions, as far as I can tell are identical between the two folders, yet using the first folder gives me permission errors.

How can I diagnose this further?

ls -l gives:

drwxrwxr-x 2 daniel daniel 4096 Apr 26 19:10 public
drwxrwxr-x 2 daniel daniel 4096 Apr 26 19:10 test

Edit

Contents of /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
    DocumentRoot /home/daniel/public/default/public/
    DirectoryIndex index.html index.php
    LogLevel warn
    ErrorLog /home/daniel/public/default/log/error.log
    CustomLog /home/daniel/public/default/log/access.log combined
</VirtualHost>

I have the following directive setup in /etc/apache2/apache2.conf

<Directory /home/daniel/public/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

From under /home/daniel/public/default running ls -Zd public test gives

drwxrwxr-x 2 daniel daniel ? 4096 Apr 28 13:44 public
drwxrwxr-x 2 daniel daniel ? 4096 Apr 28 13:44 test
share|improve this question
    
What is your DocumentRoot? –  Gnouc Apr 26 at 18:53
    
What is inside test/ and public/ respectively? Have you enabled DirectoryIndex or is there an index.html on both (and if so, are the file permissions on it identical)? –  Sami Laine Apr 26 at 19:21
    
You didn't tell us what system you are using, so please show us output of: ls -Zd public test –  Artur Szymczak Apr 26 at 19:38
    
Not enough information, especially missing details of the system, your steps, documentation you followed, etc. –  Pavel Šimerda Apr 26 at 20:24
    
Please give us some of the key stanzas from your httpd.conf file. Also take a look at your error logs, often here: /var/log/httpd/error_log. I like to tail it like this: tail -f /var/log/httpd/error_log and then reload the URL that's causing issues. You should see a 200 if it's working, otherwise you'll see the 403 message. –  slm Apr 26 at 23:40

2 Answers 2

I suggest checking the Apache error log (in /var/log/apache/ on Debian/Ubuntu or /var/log/httpd/ on RedHat and derivatives). The error log will give you a more verbose indication of what's wrong; where's it's a permissions error or something else.

Another thing to try is to try and stat the file you're trying to access with sudo, with Apache's user. Something along the lines of:

sudo -u apache2 stat /var/www/public/index.html

That's assuming your web root is in /var/www and that your Apache server runs as the apache2 user. The above command will confirm whether or not the Apache process is able to read the file in question (has sufficient filesystem permissions). If it's readable (you get stat output instead of Permission denied), then the issue most likely lies with the Apache server config itself, like @mdpc suggested.

share|improve this answer
    
Running sudo -u www-data stat /home/daniel/public/default/public/index.html worked OK. –  Pedder Apr 28 at 13:25

Look at your apache configuration files to see if there are any allow/deny directives inside some of the directories.

share|improve this answer

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.