600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 403 Forbidden You don‘t have permission to access this resource. Apache Server at IP Port 80的解决方法

403 Forbidden You don‘t have permission to access this resource. Apache Server at IP Port 80的解决方法

时间:2020-10-11 02:54:39

相关推荐

403 Forbidden You don‘t have permission to access this resource. Apache Server at IP Port 80的解决方法

ECS下载站Forbidden You don't have permission to access this resource. Apache Server at IP Port 80的解决方法

前言出现403 Forbidden报错尝试解决

使用Aliyun阿里云ECS云服务器及宝塔安装LAMP环境并搭建WordPress博客

前言

笔者搭建好ECS的WordPress站发现登录地址:

http://1.2.3.4/wp-login.php

或者默认解析的地址(也就是访客80端口首先看到的界面):

http://1.2.3.4/index.php

都可以在网站目录下找到对应的同名文件。

在宝塔的Web UI中,点左侧网站,可以看到当初设置的网站目录:

例如,笔者是在/www/wwwroot/blog,那么,继续从左侧的文件点进去,切换到对应的路径下,可以看到:

index.phpwp-login.php甚至还有404.html等众多文件。不难想到,这是Apache讲80端口的访问映射到了该路径。

那么,只需要把自己的文件拖到这个路径下/该路径的某文件夹,即可实现类似笔者家里群晖DS218j(屌丝专用2盘位产的低配NAS机)私有云分享文件的效果。任何人只要有http连接就可以访问及下载,没有某猫盘vip的朋友显然很实用。虽然笔者年租金高达100+软妹币的阿里云ECS只有1M带宽,总还是比猫盘限速20KB/s舒服些。。。

笔者使用宝塔的web UI在/www/wwwroot/blog/某路径拖了个之前随便写的1.txt,然后进行访问:

http://ip/某多级路径/1.txt

发现网址变成了:

http://ip/某串码/多级路径某串码E8%AF%95/1.txt

内容显示:

import java.util.Scanner;public class Demo1 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int score = sc.nextInt();if (score >= 90 && score <= 100) {System.out.println("浼樼");} else if (score >= 80 && score < 90) {System.out.println("濂�");} else if (score >= 70 && score < 80) {System.out.println("鑹�");}else if(score >= 60 && score < 70){System.out.println("鍙婃牸");}else if (score >= 0 && score < 60){System.out.println("涓嶅強鏍�");}}}

乱码了。。。Apache对中文支持很不友好。。。

出现403 Forbidden报错

笔者再次访问上一级目录:

http://ip/某路径/

发现报错:

403 Forbidden You don’t have permission to access this resource. Apache Server at IP Port 80。。。

鹅鹅鹅。。。

尝试解决

宝塔web UI中左侧 网站→设置→配置文件,发现:

#PATH<Directory "/www/wwwroot/blog">SetOutputFilter DEFLATEOptions FollowSymLinksAllowOverride AllRequire all grantedDirectoryIndex index.php index.html index.htm default.php default.html default.htm</Directory>

好吧,这就是Apache解析路径。。。

添加:

<Directory "/www/wwwroot/blog/某多级路径名">Options Indexes FollowSymLinks</Directory>

并保存:

这么做就可以将访问80端口下某路径的请求映射到该目录,且Options Indexes FollowSymLinks配置允许访客查看目录结构及目录内的其余内容,原先的Options FollowSymLinks只允许访客查看具体的某个文件。

重新访问设置好的路径:

http://ip/某多级路径名

发现可以访问目录了,路径乱码是因为有中文,切换为纯英文即可。于是解决了403报错的问题。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。