首页 新闻 会员 周边

nginx 配置问题

0
悬赏园豆:20 [已关闭问题] 关闭于 2016-12-20 15:31

首先说明,nginx和web网站都部署在同一个服务器上。

nginx 已经正常启动,如图

部署到IIS中的网站,

http://10.6.8.131:8040/Home/

http://10.6.8.131:8041/Home/

显示如图:

 

 

为什么访问 http://10.6.8.131:8888/Home/  显示404出错

 

Nginx 日志:

2016/12/20 15:04:08 [error] 21292#26476: *1 "E:\Work\Nginx\nginx-1.10.2\nginx-1.10.2/html/Home/index.html" is not found (3: The system cannot find the path specified), client: 10.6.8.131, server: 10.6.8.131, request: "GET /Home/ HTTP/1.1", host: "10.6.8.131:8888"

访问http://10.6.8.131:8888/Home/,将请求资源定位到Nginx安装目录的html文件夹下了,如何配置,将请求资源定位到应用的iis发布目录下呢?

摆脱菜鸟的主页 摆脱菜鸟 | 初学一级 | 园豆:16
提问于:2016-12-20 15:10
< >
分享
所有回答(1)
0

配置location /中 设置proxy_pass  ,指向服务器的集群 

#服务器的集群  
    upstream  site {
      server   10.6.8.131:8040 weight=2;
        server   10.6.8.131:8041 weight=1;  
    }
    server {
        listen       8888;
        server_name  10.6.8.131;
     #root 10.6.8.131/;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
            #其中site 对应着upstream设置的集群名称
             proxy_pass         http://site;
        }

摆脱菜鸟 | 园豆:16 (初学一级) | 2016-12-20 15:31
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册