windows server 下iis, nginx 代理 負載

來源:互聯網
上載者:User

標籤:需要   blog   報表   red   導致   ffffff   local   服務   error   

  之前用.net做的網站,都是用iis ,現在應為一些需求 需要使用到nginx 配合使用,不多說,來實在的!

 

一、nginx 相關配置 自行百度吧 網上很多 。

  demo:

 1 upstream web_www{ 2         server 127.0.0.1:5006; 3         server 192.168.1.1:5006;# 可以配置權重 訪問方式 4                  #可以更多個     5     } 6     server {  7         listen       80; 8         server_name  xxx.domain.com;#網域名稱 9 10        #如果是防止爬蟲抓取的使用11          if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot") 12         { 13         return 403; 14         } 15 16         location / { 17                   proxy_set_header X-Real-IP $remote_addr;18                   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;19                   proxy_set_header Host $http_host;20                   proxy_set_header X-NginX-Proxy true;21                   proxy_pass http://web_www;22                    23                   proxy_redirect off;24                   client_max_body_size    20m;  25         }26         root   html;  27         index  index.aspx;  28      29         30         error_page   500 502 503 504  /50x.html;31         location = /50x.html {32             root   html;33         } 34      35     }
View Code

  

  

二、nginx 啟動不成功:

  如果伺服器已經安裝了iis ,想使用nginx 可能遇到各種坑,各種80佔用 nginx啟動不成功, 注意查看nginx的logs下的錯誤資訊

可能是配置錯誤導致啟動不成功,

  例如:如果是第一行錯誤,一般第一行是注釋掉的不會出問題,那麼應該是包含bom格式的編碼

     如果出現  bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions) 那基本上就妥妥的是80連接埠佔用了

解決方案是a.  telnet 127.0.0.1 80  然後斷行符號 應該有提示 

            1 如果是iis佔用會有  這樣樣  HTTP/1.1 400 Bad Request  Content-Type: text/html; charset=us-ascii      Server: Microsoft-HTTPAPI/2.0 之類的  停用iiis 試試

            2 如果依然不行 停止 服務 iis admin 試試

       b.  netstat -aon  | findstr  "80"   在 tasklist  發現是  有個id 是4的 那就是 system這個進程了  解決方案是  :  

            1  如果有安裝sql資料庫 停用報表格服務   ,

            2 如果依然不行  開啟註冊表 運行 輸入regedit 找到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP 修改項start 將3改為0 

    至此 基本上可以解決 ,解決方案順序根據情況來

 

                  

        

 

  

windows server 下iis, nginx 代理 負載

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.