zoukankan      html  css  js  c++  java
  • [转]权限问题导致Nginx 403 Forbidden错误的解决方法

    权限问题导致Nginx 403 Forbidden错误的解决方法

    投稿:junjie 字体:[增加 减小] 类型:转载 时间:2014-08-22 

    这篇文章主要介绍了权限问题导致Nginx 403 Forbidden错误的解决方法,本文中导致 403 Forbidden错误的原因是配置文件中没有指明一个用户,需要的朋友可以参考下
     

    今天在一个新的环境上安装nginx,结果访问的都是403

     

    通常显示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再访问,就可以正常访问了

    重启nginx再访问,就可以正常访问了

  • 相关阅读:
    Django组件之contenttype
    DRF 分页
    DRF的解析器和渲染器
    DRF 权限 频率
    DRF 版本 认证
    django Rest Framework 视图和路由
    Serialzers 序列化组件
    FBV和CBV区别
    RESTful规范
    SecureCRT最佳配置方案
  • 原文地址:https://www.cnblogs.com/skysowe/p/6183219.html
Copyright © 2011-2022 走看看