Nginx反向 ProxyIIS

來源:互聯網
上載者:User


Nginx反向 ProxyIIS 最近伺服器老是掛起,IIS莫名崩潰。事後看日誌,發現是應用程式在寫的時候很多異常,拋出未被接住,傷不起啊。想想每次伺服器崩潰之後,被催到恢複的感覺,不爽。於是,想到了改變。前不久看到一技術貼,說可以用nginx反向 ProxyIIS。好東東,nginx的輕量、穩定、靈活給我留下了相當好的印象。話不多說,直接開整吧。我的大體思路如下:  www.2cto.com        domain0(Linux,nginx)                          |          xen   |                     |                |domain1(IIS)  domain2..... domainXdomain0:CETNOS、xen、nginx(部署地址:/www/nginx/)(靜態資源,此處以JPG為例:/www/nginx/image)domain1...domainx:內網址192.168.0.x,windows server 2008;IIS7.0nginx是編譯安裝的。所有設定都是預設的。好吧,直接上設定檔。  1 vim /www/nginx/conf/nginx.conf 2   www.2cto.com   3  4 worker_processes  1; 5 events { 6     worker_connections  1024; 7 } 8 http { 9     include safe_block_deny.conf;10     include mime.types;11     default_type application/octet-stream;12     tcp_nodelay on;13     sendfile on;14     gzip on;15     upstream localhost {16         server 192.168.0.29:80; #domain117         server 192.168.0.33:80; #domain218     }19     server {20         listen       80;21         server_name  localhost;22         location / {23             root   html;24             index  index.html index.htm;25         }26         location ~* \.(aspx)$ {27             proxy_pass http://localhost;28             proxy_set_header X-Real-IP $remote_addr;29         }  www.2cto.com  30         location ~ ^/(image|js|css)/  {31              root   /www/nginx;32              expires 24h;33         }34         error_page   500 502 503 504  /50x.html;35         location = /50x.html {36             root   html;37         }38     }39 }  作者 davyfamer

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.