我的知识记录

虚拟主机后台403_错误日志定位法

后台403 时分清是服务器 403 还是 CDN/WAF 403。服务器 403 页面有 Nginx/Apache 标识,CDN 403 页面有 CDN 标识。CDN 403 通常是 WAF 规则拦截或防盗链,服务器 403 是权限或配置问题。用 curl -x 127.0.0.1:80 测源站,区分层级。

默认首页排查:Nginx 的 index 指令(index index.html index.htm index.php;),Apache 的 DirectoryIndex,IIS 的默认文档。目录下没有这些文件且目录浏览关闭就返回 403。上传 index 文件或在配置里加默认首页。虚拟主机在面板的"默认文档"里设置。

参考(403权限修复命令): ``` # 查看权限和属主 ls -la /www/wwwroot/域名 ls -la /www/wwwroot/域名/index.php

# 批量修复权限 find /www/wwwroot/域名 -type d -exec chmod 755 {} ; find /www/wwwroot/域名 -type f -exec chmod 644 {} ;

# 修复属主(Nginx) chown -R www:www /www/wwwroot/域名 # Apache chown -R apache:apache /www/wwwroot/域名 # 写入目录给775 chmod 775 /www/wwwroot/域名/upload chown www:www /www/wwwroot/域名/upload

# Nginx错误日志 tail -50 /var/log/nginx/error.log # Apache错误日志 tail -50 /var/log/httpd/error_log

# 测试源站(绕过CDN) curl -I -x 127.0.0.1:80 http://域名/ ```

预防 403:权限规范化(目录 755 文件 644)、默认首页必传、修改配置前备份、防盗链白名单包含所有绑定域名、定期检查访问日志的 403 状态码。403 占比超过 5% 就要排查原因,正常站点 403 占比在 1% 以下。

Apache 403 专项:Apache 错误日志在 /var/log/httpd/error_log 或 /var/log/apache2/error.log,常见 "client denied by server configuration"(deny 规则或 Options)、"Permission denied"(文件系统权限)。.htaccess 语法错误会导致 500 不是 403,注意区分。

虚拟主机后台403_错误日志定位法

标签:

更新时间:2026-09-02 12:51:31

上一篇:shopex绿卡授权ERP对接_授权用户进销存系统集成

下一篇:Word创建时间修改时间改成当前时间批量处理|论文终稿提交高效Word 2013文档时间戳一键更新