NGINX作为负载均衡器到IIS Web服务器

我正在尝试为两个IIS Web服务器build立一个基于NGINX的简单软件负载平衡器。 这里是我为负载均衡创build的NGINXconfiguration文件:

http { include /etc/nginx/mime.types; default_type application/octet-stream; ##### # Definition von Load Balancing Cluster fur Share Point Farm ###### upstream SPcluster { ip_hash; server 172.22.1.134:80 weight=10 max_fails=3 fail_timeout=15; server 172.22.1.133:80 weight=10 max_fails=3 fail_timeout=15; } server { listen 172.22.9.100:80; location / { proxy_pass http://SPcluster; } } log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; } error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } 

问题是,我试图通过Web浏览器访问负载平衡器的IP我得到以下错误:

“/”应用程序中的服务器错误。

无法find该资源。 说明:HTTP 404.您正在查找的资源(或其某个依赖项)可能已被删除,名称已更改或暂时不可用。 请检查以下URL并确保拼写正确。

请求的url:/SitePages/Homepage.aspx

我的configuration有什么问题? 为什么nginx服务器会尝试在负载平衡器服务器上查找html文件,并且不会将请求redirect到实际可以对其进行服务的Web服务器?

尝试在你的proxy_pass行下包括这个:

  proxy_set_header Host $http_host;