Apache - Permissions are missing on a component of

2020-06-03 04:36发布

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]

6条回答
不美不萌又怎样
2楼-- · 2020-06-03 05:15

setsebool -P httpd_enable_homedirs 1

chcon -R -t httpd_sys_content_t /home/user/public_html

查看更多
乱世女痞
3楼-- · 2020-06-03 05:16

Or you can run

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

In those folders...

查看更多
女痞
4楼-- · 2020-06-03 05:24

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/
查看更多
啃猪蹄的小仙女
5楼-- · 2020-06-03 05:25

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 :)

查看更多
Luminary・发光体
6楼-- · 2020-06-03 05:29

In my case the containing folder did not have the +x permission, changing it to 755 did the trick.

查看更多
闹够了就滚
7楼-- · 2020-06-03 05:31

On macOS it might be caused by a user group permission issue.

Go to httpd.conf file (located at /usr/local/etc/httpd if Apache is installed by Homebrew). Find <IfModule unixd_module> and change the value in front of User to your computer username (that you log in with). Restart Apache.

This needs to be done to PHP-FMP as well if you are using that with Apache. Find php-fpm.conf file (usually located at /usr/local/etc/php/7.x/ and find the pool definitions:

uncomment include=/usr/local/etc/php/7.x/php-fpm.d/*.conf if commented and save the file. now open the recently uncommented file and find user = and change the value of user to your computer username. Now restart PHP service.

查看更多
登录 后发表回答