Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache - Permissions are missing on a component of the path

None of my website images are loaded, although paths are correct. In my Apache logs, I have plenty of :

(13)Permission denied: [client 87.231.108.18:57108] AH00035: access to 
my/file/path/some-photo.jpg denied because search permissions are missing 
on a component of the path

Within httpd.conf file :

User apache
Group apache

All the way down to my website directory, folders are owned by apache:apache, with chmod set to 774 all the way down.

SELinux boolean httpd_can_network_connect has been is On.

I am using a .htaccess file to redirect my domain name to the appropriate directory. I suspect this might be cause the issue but... this is nothing more than a gut feeling.

I do need help, any suggestion is most welcomed. Many thanks!

EDIT Content of the .htaccess file :

RewriteEngine On
Options +FollowSymLinks

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} www\.domain\.com
RewriteRule (.*) /domain/$1 [L]
like image 350
Alexandre Bourlier Avatar asked Aug 07 '14 18:08

Alexandre Bourlier


People also ask

How do I give Apache permission to a folder?

There may be some cases where you have to give the web server write permission to a file, or to a directory - this can be achieved by doing sudo chmod g+w /var/www/html/PATH (where PATH is the path to the file or folder in the directory structure where you need to apply the write permissions for the web server).

How do I fix 13 Permission denied?

The PermissionError: [errno 13] permission denied error occurs when you try to access a file from Python without having the necessary permissions. To fix this error, use the chmod or chown command to change the permissions of the file so that the right user and/or group can access the file.

How do I fix permissions denied in Windows 10?

Right-click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to see the permissions that you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.

What is Permission denied Code 13?

(13) Permission Denied. Error 13 indicates a filesystem permissions problem. That is, Apache was denied access to a file or directory due to incorrect permissions. It does not, in general, imply a problem in the Apache configuration files.


2 Answers

What worked for me was that all component directories in the path needed execute permissions for all

so if the path of the website is /home/user1/public_html/docroot

chmod +x /home/user1/
chmod +x /home/user1/public_html/
chmod +x /home/user1/public_html/docroot/
like image 118
GiorgosK Avatar answered Sep 24 '22 06:09

GiorgosK


I finally found it! Thanks a ton Justin lurman to poiting out the .htaccess file. It made me see that Wordpress didn't have the right to edit my .htaccess file anymore. That was even more weird because I was 100% sure that permissions were good (even way too permissive if you ask me).

So I looked into SElinux, as I know it can play tricks on me at times and I was right. Issuing the following command solved it :

chcon -R --type=httpd_sys_rw_content_t wp-content/

I hope that helps someone else :)

like image 25
Alexandre Bourlier Avatar answered Sep 25 '22 06:09

Alexandre Bourlier