3

This question already has an answer here:

As per title - I have a server running wherein I can access index.html placed in the document root (/var/www/html), but not any subdirectories within the document root.

Permissions on root index:

$ namei -l /var/www/html/index.html
f: /var/www/html/index.html
dr-xr-xr-x root   root   /
drwxr-xr-x root   root   var
drwxr-xr-x root   apache www
drwxr-x--- myuser apache html
-rwxr-x--- myuser apache index.html

Permissions on subdirectory index:

$ namei -l /var/www/html/foo/bar/index.html          
f: /var/www/html/foo/bar/index.html
dr-xr-xr-x root   root   /
drwxr-xr-x root   root   var
drwxr-xr-x root   apache www
drwxr-x--- myuser apache html
drwxr-x--- myuser apache foo
drwxr-x--- myuser apache bar
-rwxr-x--- myuser apache index.html

Security context info on /var/www/html:

$ ls -Z /var/www/html
drwxr-x---. myuser apache unconfined_u:object_r:httpd_sys_content_t:s0 cszg
-rwxr-x---. myuser apache unconfined_u:object_r:httpd_sys_content_t:s0 index.html

Security context info on /var/www/html/foo/bar:

$ ls -Z /var/www/html/foo/bar                        
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 3rdpartylicenses.txt
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 es2015-polyfills.24633e0ae24ffe204041.js
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 favicon.ico
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 index.html
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 main.38de9b2b74351642ba79.js
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 pdfjsWorker.382cb0cf8fa9c06b8500.js
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 polyfills.e1e93dfb20909209aa48.js
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 runtime.1f744383c7edc51f6732.js
-rwxr-x---. myuser apache unconfined_u:object_r:user_home_t:s0 styles.9e51190222492c49b9b3.css

Finally, here's the relevant parts of httpd.conf:

User apache
Group apache

DocumentRoot "/var/www/html"

<Directory />
    AllowOverride None
    DirectoryIndex index.html
    Require all denied
</Directory>
<Directory "/var/www/html">
    Options FollowSymLinks
    Require all granted
</Directory>

The error logs indicate this is a permissions problem (AH00132), but as far as I can see the permissions are exactly the same for the root index and the subdir index?

marked as duplicate by Michael Hampton Jun 13 at 16:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Aha, I've seen that before. See the linked Q&A. – Michael Hampton Jun 13 at 16:00
  • @MichaelHampton Outstanding, thank you! – Ian Knight Jun 13 at 16:59

Browse other questions tagged or ask your own question.