解决Nginx出现403 forbidden的问题

访问页面时返回403,直接使用ip+端口访问是没有问题的,怀疑nginx配置有问题。

查看nginx日志

查看nginx.conf文件,判断日志的输出地址。

vi /etc/nginx/nginx.conf

打开error.log,发现类型的日志,大致确认是权限问题

2017/09/04 10:52:25 [error] 8196#0: *14 open() "/home/guopei/blog/www/static/js/admin.bundle.js" failed (13: Permission denied), client: 104.192.108.10, server: geekfe.com, request: "GET /static/js/admin.bundle.js?v=67cf9.js HTTP/1.1", host: "blog.geekfe.com", referrer: "http://blog.geekfe.com/admin"

查看nginx进程

ps aux|grep nginx

返回如下

root      9145  0.0  0.4 122288  2176 ?        Ss   10:56   0:00 nginx: master process /usr/sbin/nginx
root      9146  0.0  0.7 122808  3880 ?        S    10:56   0:00 nginx: worker process
root      9212  0.0  0.1 112644   960 pts/0    S+   10:57   0:00 grep --color=auto nginx

查看nginx.conf

user nginx;

改成

user root;

重启nginx服务

service nginx restart;

重启后问题解决。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值