zoukankan      html  css  js  c++  java
  • nginx 读取文件 permission denied

    nginx 是在root用户下安装的,静态网页的目录/var/www/html/ 目录下的内容所有者也是root 用户,按照 nginx配置文件中location说明 配置静态文件访问地址。

    使用网址访问后出现错误日志显示如下

    root@localhost:/etc/nginx# more /var/log/nginx/error.log
    2018/07/24 11:06:05 [error] 17823#17823: *21 open() "/var/www/html/show/project/test1.html" failed (13: Permission denied), client: 101.228.94.31, server: _, request: "GET 
    /show/project/test1.html HTTP/1.1", host: "45.78.33.187"
    2018/07/24 11:06:06 [error] 17823#17823: *21 open() "/var/www/html/show/project/test1.html" failed (13: Permission denied), client: 101.228.94.31, server: _, request: "GET 
    /show/project/test1.html HTTP/1.1", host: "45.78.33.187"
    2018/07/24 11:06:16 [error] 17823#17823: *23 open() "/var/www/html/show/project/test1.html" failed (13: Permission denied), client: 101.228.94.31, server: _, request: "GET 
    /show/project/test1.html HTTP/1.1", host: "45.78.33.187"
    2018/07/24 11:06:16 [error] 17823#17823: *23 open() "/var/www/html/show/project/test1.html" failed (13: Permission denied), client: 101.228.94.31, server: _, request: "GET 
    /show/project/test1.html HTTP/1.1", host: "45.78.33.187"
    2018/07/24 11:06:22 [error] 17823#17823: *25 directory index of "/var/www/html/show/project/" is forbidden, client: 101.228.94.31, server: _, request: "GET /show/project/ H
    TTP/1.1", host: "45.78.33.187"
    2018/07/24 11:06:22 [error] 17823#17823: *25 directory index of "/var/www/html/show/project/" is forbidden, client: 101.228.94.31, server: _, request: "GET /show/project/ H
    TTP/1.1", host: "45.78.33.187"
    2018/07/24 11:10:02 [error] 17823#17823: *30 open() "/var/www/html/show/project/test1.html" failed (13: Permission denied), client: 101.228.94.31, server: _, request: "GET 
    /show/project/test1.html HTTP/1.1", host: "45.78.33.187"
    2018/07/24 11:10:02 [error] 17823#17823: *30 open() "/var/www/html/show/project/test1.html" failed (13: Permission denied), client: 101.228.94.31, server: _, request: "GET 
    /show/project/test1.html HTTP/1.1", host: "45.78.33.187"
    2018/07/24 11:30:10 [emerg] 17956#17956: invalid number of arguments in "root" directive in /etc/nginx/sites-enabled/default:47
    2018/07/24 11:31:56 [notice] 17960#17960: signal process started
    2018/07/24 11:32:02 [error] 17961#17961: *38 open() "/var/www/html/show/project/test1.html" failed (13: Permission denied), client: 101.228.94.31, server: _, request: "GET 
    /show/project/test1.html HTTP/1.1", host: "45.78.33.187"
    2018/07/24 11:32:03 [error] 17961#17961: *38 open() "/var/www/html/show/project/test1.html" failed (13: Permission denied), client: 101.228.94.31, server: _, request: "GET 
    /show/project/test1.html HTTP/1.1", host: "45.78.33.187"

    修改配置文件的 user 配置,改为 root,默认位置是 /etc/nginx/nginx.cnf。

    修改好后重启nginx,使用命令如下

    nginx -s reload

    重新访问页面正常了。

  • 相关阅读:
    hive表增量抽取到oracle数据库的通用程序(二)
    java进程的守护进程脚本
    hadoop2.7节点的动态增加与删除
    hive表增量抽取到oracle数据库的通用程序(一)
    arduino 驱动电调
    arduino IO口
    通过电机编码器AB相输出确定电机转向
    Wifi小车资料
    winform 按键控制
    vs2010 EF4.0 访问mysql
  • 原文地址:https://www.cnblogs.com/zhaopengcheng/p/9363436.html
Copyright © 2011-2022 走看看