e站显示403解决方法有重建dns缓存、修改文件夹安全属性等。
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错误代码的分类介绍:
1、403.1
403.1错误是由于“执行”访问被禁止而造成的,若试图从目录中执行CGI、ISAPI或其他可执行程序,但该目录不允许执行程序时便会出现此种错误。
2、403.2
403.2错误是由于“读取”访问被禁止而造成的。导致此错误是由于没有可用的默认网页并且没有对目录启用目录浏览,或者要显示的HTML网页所驻留的目录仅标记为“可执行”或“脚本”权限。
3、403.3
403.3错误是由于“写入”访问被禁止而造成的,当试图将文件上载到目录或在目录中修改文件,但该目录不允许“写”访问时就会出现此种错误。