posts - 17,  comments - 183,  views - 28577
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

 

测试一马

最近服务器老是挂起,IIS莫名崩溃。事后看日志,发现是应用程序在写的时候很多异常,抛出未被接住,伤不起啊。

想想每次服务器崩溃之后,被催到恢复的感觉,不爽。于是,想到了改变。

前不久看到一技术贴,说可以用nginx反向代理IIS。好东东,nginx的轻量、稳定、灵活给我留下了相当好的印象。话不多说,直接开整吧。

我的大体思路如下:

      domain0(Linux,nginx)

                          |

          xen

   |                     |                |

domain1(IIS)  domain2..... domainX

domain0:CETNOS、xen、nginx(部署地址:/www/nginx/)(静态资源,此处以JPG为例:/www/nginx/image)

domain1...domainx:内网址192.168.0.x,windows server 2008;IIS7.0

nginx是编译安装的。

所有设置都是默认的。

好吧,直接上配置文件。

复制代码
 1 vim /www/nginx/conf/nginx.conf
 2 
 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; #domain1
17         server 192.168.0.33:80; #domain2
18     }
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         }
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 }
复制代码

OK,完了,就这么简单。。。

当然,其实并不简单,因为后边还有SESSION的问题没解决。下次吧。

还有一个疑问,这种负载是按连接数来的,请问,有没有按访问速度来的呢?

posted on   davyfamer  阅读(3805)  评论(6编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· SQL Server 2025 AI相关能力初探
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示