nginx http 403 禁止访问怎么解决
答案:2 悬赏:80
解决时间 2021-02-10 07:03
- 提问者网友:伴他一生,无悔
- 2021-02-09 17:39
nginx http 403 禁止访问怎么解决
最佳答案
- 二级知识专家网友:陪衬角色
- 2021-02-09 19:00
通常显示403我立马都会想到路径配置不对,但我仔细看了一下,目录路径没问题:
nginx.conf:
复制代码代码如下:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /root/html;
index index.html index.htm;
}
}
系统中的路径查询结果:
复制代码代码如下:
[root@lizhong html]# ll /root/html/
总用量 4
-rw-r--r-- 1 root root 3 4月 18 11:07 index.html
目录时存在,重启nginx还是这个错误,后来想到是不是权限问题?于是在nginx.conf头部加入一行:
复制代码代码如下:
user root;
重启nginx再访问,就可以正常访问了
nginx.conf:
复制代码代码如下:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /root/html;
index index.html index.htm;
}
}
系统中的路径查询结果:
复制代码代码如下:
[root@lizhong html]# ll /root/html/
总用量 4
-rw-r--r-- 1 root root 3 4月 18 11:07 index.html
目录时存在,重启nginx还是这个错误,后来想到是不是权限问题?于是在nginx.conf头部加入一行:
复制代码代码如下:
user root;
重启nginx再访问,就可以正常访问了
全部回答
- 1楼网友:开心就好
- 2021-02-09 19:43
你说呢...
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯