关于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 发现问题解决
posted @ 2017-04-07 10:32  reblue520  阅读(5441)  评论(0编辑  收藏  举报