Apache 403 Forbidden error

I added additional folder for browser to access, Apache encountered and returned error: 403 Forbidden,


Forbidden

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


searched the solution, 

1, changed the httpd.conf folder access attribute, still not working,

 Require all granted


2, changed SELinux,

changed two booleans, still not working,

'httpd_enable_homedirs' boolean and 'httpd_read_user_content' boolean


3, changed SELinux context, resolved, as the one person in the internet mentioned,

The issue is caused when you mv something from one place to another. It preserves the selinux context of the original when you move it, so if you untar something in /home or /tmp it gets given an selinux context that matches its location. Now you mv that to /var/www/html and it takes the context saying it belongs in /tmp or /home with it and httpd is not allowed by policy to access those files. 

If you cp the files instead of mv them, the selinux context gets assigned according to the location you're copying to, not where it's coming from. Running restorecon puts the context back to its default and fixes it too.


Yes, I have done some mv action of the folder, needs to restore the selinux context, resolved!

restorecon -r /var/www/yourfolder


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值