• 关于nginx报错/usr/share/nginx/html/jiankongshare" failed (2: No such file or directory)的问题解决



    nginx的location虚拟目录配置:

    monitor.conf

    server {  
        server_name   monitor.chinasoft.com;  
        server_name   1.1.1.1;
        error_log  /data/logs/web-acccess.log  info;  
        access_log /data/logs/web-error.log;  
      
        location /jiankongshare{
            alias /data/monitor_share; #正式环境地址
       index index.html;
        }
        location /jian/{
            proxy_set_header Host $host;
            proxy_set_header X-Real-Ip $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_pass http://localhost:8082/;#正式服务器地址
        }

    }


    访问1.1.1.1/jiankongshare报错如下:

    2017/04/07 10:15:54 [error] 23876#0: *1 open() "/usr/share/nginx/html/jiankongshare" failed (2: No such file or directory), client: 61.141.64.212, server: monitor.chinaost.com, request: "GET /jiankongshare HTTP/1.1", host: "1.1.1.1"
    2017/04/07 10:15:54 [error] 23876#0: *1 open() "/usr/share/nginx/html/jiankongshare" failed (2: No such file or directory), client: 61.141.64.212, server: monitor.chinaost.com, request: "GET /jiankongshare HTTP/1.1", host: "1.1.1.1"
    2017/04/07 10:15:54 [error] 23876#0: *1 open() "/usr/share/nginx/html/jiankongshare" failed (2: No such file or directory), client: 61.141.64.212, server: monitor.chinaost.com, request: "GET /jiankongshare HTTP/1.1", host: "1.1.1.1"
    2017/04/07 10:15:55 [error] 23876#0: *1 open() "/usr/share/nginx/html/jiankongshare" failed (2: No such file or directory), client: 61.141.64.212, server: monitor.chinaost.com, request: "GET /jiankongshare HTTP/1.1", host: "1.1.1.1"
    2017/04/07 10:15:55 [error] 23876#0: *1 open() "/usr/share/nginx/html/jiankongshare" failed (2: No such file or directory), client: 61.141.64.212, server: monitor.chinaost.com, request: "GET /jiankongshare HTTP/1.1", host: "1.1.1.1"

    分析:


    nginx还是默认到
    /usr/share/nginx/html/jiankongshare 这个根目录下去找我们的html文件,通过修改default.conf及nginx.conf的根目录也无法改变目录的配置,重启无效

    其实有两台nginx做负载均衡,另外一台是ok的最后不得已直接删除nginx,重新安装,发现问题解决

    解决办法:

    关闭服务
    service nginx stop
    删除nginx
    rpm -e --nodeps nginx-1.10.2-1.el6.x86_64
    重新安装
    yum install -y nginx

    再次修改配置,启动nginx,再次访问1.1.1.1/jiankongshare 发现问题解决
  • 相关阅读:
    整合ssm
    卸载,安装JDK
    基本的Dos命令
    基本的Dos命令
    Typora软件操作教程(简单的编写文档,方便,美观,有效的 HTML 文档)
    Vuex 第6节 module模块组
    Vuex 第5节 actions异步修改状态
    Vuex 第4节 getters计算过滤操作
    Vuex 第3节 Mutations修改状态
    Vuex 第2节 state访问状态对象
  • 原文地址:https://www.cnblogs.com/reblue520/p/6784494.html
Copyright © 2020-2023  润新知