当前位置:首页 » 密码管理 » apache拒绝访问文件

apache拒绝访问文件

发布时间: 2023-01-07 22:57:45

A. 403拒绝访问解决办法有哪些

解决403 forbidden错误的方法:

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

3、关于apache导致的403 forbidden错误的解决办法

打开apache的配置文件httpd.conf,找到这段代码:

Options FollowSymLinks AllowOverride None Order deny,allow Deny from all

有时候由于配置了php后,这里的“Deny from all”已经拒绝了一切连接。把该行改成“allow from all”,修改后的代码如下,问题解决。

Options FollowSymLinks AllowOverride None Order deny,allow Allow from all

之所以会出现错误,是因为大多数的国外主机在配置Apache的时候启用了mod_security,也就是开启了安全检查,如果提交的信息中包含select , % , bin等关键字,Apache就会禁止,并给出403,404,500等错误。

热点内容
java返回this 发布:2025-10-20 08:28:16 浏览:594
制作脚本网站 发布:2025-10-20 08:17:34 浏览:889
python中的init方法 发布:2025-10-20 08:17:33 浏览:583
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:766
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:685
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:1014
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:257
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:115
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:807
python股票数据获取 发布:2025-10-20 07:39:44 浏览:714