403 forbidden什么意思/http状态码403怎么解决

2021-11-19
967

403 forbidden什么意思
403 forbidden是http返回的一个状态码,可以简单的理解没有权限访问网站,服务器接受了请求,但是拒绝执行它,表示资源不可用,404是一种常见的错误提示。
当在服务器请求的方法不是head的时候,就会返回403状态码,并且服务器会告诉用户是什么权限限制,服务器并且在返回的信息中,对什么权限进行描述,如果是不想反馈的话,可能会出现404或者403。
http状态码403怎么解决
1、重建dns缓存
对于一些常规的403 forbidden错误,建议大家首先要尝试的就是重建dns缓存,在运行中输入cmd,然后输入ipconfig /flushdns即可。如果不行的话,就需要在hosts文件里把主页解析一下了。
同时,查看是否在网站虚拟目录中添加默认文档,一般默认文档为:index.html;index.asp;index.php;index.jsp;default.htm;default.asp等。
2、修改文件夹安全属性
用以下命令修改文件夹安全属性
chcon -R -t httpd_user_content_t public_html/
所用命令解析:
ls -Z -d public_html/
  #显示文件/目录的安全语境-Z, --context
  Display  security context so it fits on most displays.  Displays only mode, user, group, security context and file name.-d, --directory
  list directory entries instead of contents, and do not dereference symbolic links
  chcon -R -t httpd_user_content_t public_html/
  #修改文件/目录的安全语境-R, --recursive
  change files and directories recursively-t, --type
  set type TYPE in the target security context
以上关于403相关知识点就介绍到这里,需要HTTP状态检测工具的可直接点击。

转载时必须以链接形式注明原始出处及本声明

扫描关注公众号