腾讯云CVM403禁止访问_文件403解决
腾讯云CVM 做文件403,Nginx 的 403 常见原因是目录下没有 index 文件且 autoindex off(目录浏览关闭),访问目录时 Nginx 找不到默认首页就返回 403。上传 index.html/index.php 或开启 autoindex 即可。Apache 的 403 常见是 Options -Indexes 或权限问题。
IP 被封和防盗链:访问日志里 403 的请求 IP 集中在某个范围,可能是 IP 黑名单;Referer 不是自己域名的 403,是防盗链。自己访问也 403 检查是否被误封(动态 IP 变了被之前的规则封了)。防盗链规则要允许空 Referer(直接访问)和自己的所有域名。
参考(Nginx 403配置示例): ``` # 默认首页 server { listen 80; server_name 域名; root /www/wwwroot/域名; index index.html index.htm index.php;
# 禁止访问特定目录 location ~* /(admin|install)/ { # deny all; # 注释掉测试 allow 你的IP; deny all; }
# PHP处理 location ~ .php$ { fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } }
# SELinux上下文(CentOS) chcon -R -t httpd_sys_content_t /www/wwwroot/域名 chcon -R -t httpd_sys_rw_content_t /www/wwwroot/域名/upload ```
排查完用百度站长平台抓取诊断确认。修复后 curl -I http://域名/页面返回 200,浏览器无痕模式访问正常,图片和静态资源都能加载。如果是权限问题,确认所有目录和文件权限正确,不要留 777。如果是规则问题,确认规则只拦截目标不影响正常访问。
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,注意区分。

更新时间:2026-08-27 11:57:14
上一篇:ThinkCMF在iis7上安装后路由不生效_URL重写模块检查与修复