日期:2014-05-17  浏览次数:20985 次

nginx代理IIS轻松实现支持JSP,PHP,ASP平台

通过使用高效代理服务器nginx代理IIS轻松实现支持JSP,PHP,ASP多功能平台

其中IIS中的站点监听端口全部设置为8080。tomcat设置为8888.

例如:

  1. IIS中有如下两站点:

??? www.56sj.net(假设由PHP实现); www.52kantv.com (假设由ASP实现)

?

??? 2.? tomcat中有以下一个站点:

??? www.piaoxingo.com (JSP实现)

?

则nginx实现代理以80端口监听http请求

?

?upstream 56sj{
??????? server www.56sj.net:8080 ;
?????????? }

??? server {
??????? listen?????? 80;
??????? server_name? www.56sj.net;

??????? #charset koi8-r;

??????? #access_log? logs/host.access.log? main;
??
??????? location / {
????????proxy_set_header Host $host;
??????? proxy_set_header X_Real_IP?$remote_addr;
?????? ?proxy_set_header X-Forwarded-For $remote_addr;
??????? proxy_pass http://56sj ;
??????? }
??? }

?upstream 52kantv{
??????? server www.52kantv.com:8080;
?????? }

??? server {
??????? listen?????? 80;
??????? server_name? www.52kantv.com;

??????? #charset koi8-r;

??????? #access_log? logs/host.access.log? main;
??
??????? location / {
????????proxy_set_header Host $host;
??????? proxy_set_header X_Real_IP?$remote_addr;
?????? ?proxy_set_header X-Forwarded-For $remote_addr;
??????? proxy_pass http://52kantv ;
??????? }
??? }

?upstream piaoxingo {
??????? server localhost:8888;
???????? }

??? server {
??????? listen?????? 80;
??????? server_name? www.piaoxingo.com;

??????? #charset koi8-r;

??????? #access_log? logs/host.access.log? main;
??
??????? location / {
????????proxy_set_header Host $host;
??????? proxy_set_header X_Real_IP?$remote_addr;
?????? ?proxy_set_header X-Forwarded-For $remote_addr;
??????? proxy_pass http://piaoxingo ;
??????? }
??? }

?大功告成!

转载请注明来自此站:http://www.56sj.net/article/116.html