连接phpMyAdmin出现异常,已配置服务器及Apache仍未解决,求修复方案
修复Apache 403 Forbidden错误的方案
- 先纠正路径笔误:你提到的
/ect/apache2/apache.conf应为/etc/apache2/apache.conf,确认编辑的是正确配置文件 - 检查网站目录与文件权限
- 将网站根目录(默认是
/var/www/html)的所有者设为Apache运行用户www-data:chown -R www-data:www-data /var/www/html - 设置合规权限:目录权限755,文件权限644
find /var/www/html -type d -exec chmod 755 {} \; find /var/www/html -type f -exec chmod 644 {} \;
- 将网站根目录(默认是
- 调整Apache目录访问配置
- 打开
/etc/apache2/apache.conf,定位到网站根目录对应的<Directory>块,确保配置如下:<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> - 若你使用自定义根目录,需同步修改对应
<Directory>块的路径与权限规则
- 打开
- 排查
.htaccess限制- 检查网站根目录下的
.htaccess文件,若存在Deny from all或其他访问限制规则,注释或删除相关内容
- 检查网站根目录下的
- 处理SELinux限制(仅适用于开启SELinux的服务器)
- 临时关闭SELinux验证是否为其导致:
setenforce 0 - 若验证有效,设置永久生效的SELinux上下文:
chcon -R -t httpd_sys_content_t /var/www/html
- 临时关闭SELinux验证是否为其导致:
- 重启Apache服务加载新配置:
systemctl restart apache2
内容的提问来源于stack exchange,提问作者DeeVee
相关产品推荐
相关产品推荐

