windows server 下iis, nginx 代理 负载
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了windows server 下iis, nginx 代理 负载,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2534字,纯文字阅读大概需要4分钟。
内容图文
![windows server 下iis, nginx 代理 负载](/upload/InfoBanner/zyjiaocheng/961/03aff96b54764962b74204dff791105d.jpg)
之前用.net做的网站,都是用iis ,现在应为一些需求 需要使用到nginx 配合使用,不多说,来实在的!
一、nginx 相关配置 自行百度吧 网上很多 。
demo:
![windows server 下iis, nginx 代理 负载 - 文章图片](/upload/getfiles/0001/2021/5/11/20210511042746787.jpg)
![windows server 下iis, nginx 代理 负载 - 文章图片](/upload/getfiles/0001/2021/5/11/20210511042746823.jpg)
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
至此 基本上可以解决 ,解决方法顺序根据情况来
转载于:https://www.cnblogs.com/WindWall/p/8064743.html
内容总结
以上是互联网集市为您收集整理的windows server 下iis, nginx 代理 负载全部内容,希望文章能够帮你解决windows server 下iis, nginx 代理 负载所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。