• 关于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 发现问题解决
  • 相关阅读:
    Emgu安装配置及使用
    ASP.NET动态网站制作(1)--html
    ASP.NET动态网站制作(0)
    文件自动拆分
    visual studio 常用快捷键
    用vector构造自动扩容的二维数组
    C++中的struct
    Word论文写作如何实现公式居中、编号右对齐
    借助 Filter 生成静态页面缓存问题
    xshell 中解决中文乱码问题
  • 原文地址:https://www.cnblogs.com/reblue520/p/6784494.html
Copyright © 2020-2023  润新知