Pat*_*ell 8 httpd centos http-status-code-403 apache-2.2
这是我在 httpd.conf 中的内容
<VirtualHost *:80>
ServerAdmin spero78@spero78.com
ServerName mcmoddr.com
ServerAlias www.mcmoddr.com
DocumentRoot /home/mcmoddr/www/
ErrorLog /mcmoddr/logs/error.log
CustomLog /mcmoddr/logs/accesslog combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
访问站点时出现 403 Forbidden 错误,这些文件是使用 vsftpd 添加的,并且具有 drwxr-xr-x 权限
小智 13
您正在使用 CentOS 的库存安装,如果正确,请检查 SELinux 是否处于强制模式
getenforce
Run Code Online (Sandbox Code Playgroud)
如果结果是“强制执行”
暂时将其更改为许可
setenforce 0
Run Code Online (Sandbox Code Playgroud)
再试一次,您也可以将网页内容的状况引导至您的主目录中的文件。
小智 9
禁用 SELinux 或在 ROOT 中运行
setsebool -P httpd_enable_homedirs on
chcon -R -t httpd_sys_content_t /home/
chcon -R -t httpd_sys_rw_content_t /home/
Run Code Online (Sandbox Code Playgroud)
小智 5
Freaktor 对“setenforce 0”的回答对我来说“有效”(谢谢!)
但是为了让它继续工作并重新启用 SELinux,我需要
sudo chcon -Rv --type=httpd_t /path/to/my/files
Run Code Online (Sandbox Code Playgroud)
...这为我的目录以及其中的所有文件和目录提供了“httpd_t”的安全上下文,这是说 SELinux 让 httpd 读取这些文件的笨拙方式。
再次启用 selinux 就像
setenforce 1
Run Code Online (Sandbox Code Playgroud)
您可能在全局配置中的某处拒绝了所有内容。尝试将其添加到 vhost 节中:
<Directory /home/mcmoddr/www>
Order allow,deny
Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
56366 次 |
| 最近记录: |