您的位置:首页 > 运维架构 > Nginx

Windows 下使用 Nginx+Mono 部署 ASP.Net

2010-04-01 04:47 661 查看
自 Mono 1.9 以来,ASP.Net 也能通过 Mono 的 fastcgi-mono-server2 在 FastCGI
下运行了,更为可贵的是,Mono 兼容 Windows ;我们可以在 Windows 下利用 lighttpd、nginx 或 Apache 等服务器上部署
ASP.Net。

我将 Mono for Windows 的 FastCGI-Mono-Server 提取出来,你可以猛击这里下载。

而 Nginx 目前也支持 Windows,是部署 Web 服务器的一个非常不错的选择,你可以在 Nginx 的官方网站找到下载。

下面是我对 Nginx nginx.conf 的配置,蓝色文字属于关键内容。

worker_processes 1;
error_log logs/error-debug.log info;

events
{
worker_connections 1024;
}

http {
include
mime.types;
default_type text/plain;
sendfile
on;

keepalive_timeout 65;
index index.html
index.htm;

server {
listen
80;
server_name yourdomain.com;
index index.aspx
default.aspx;

location / {
root
D:\www/yourwebapp;

fastcgi_pass
127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME
$document_root/$fastcgi_script_name;
include
fastcgi_params;
}
}
}

然后将上面的 FastCGI-Mono-Server 提取出来,所有文件全部注册到 GAC(否则 Web 应用会找不到他们,当然你也可以直接放到
webapp/bin),然后解压到某个文件夹,这里假设为 D:/FastCGI-Mono-Server。

之后我们就可以按下列命令运行 FastCGI:

fastcgi-mono-server2 /socket=tcp:127.0.0.1:8000
/root="D:\www\yourwebapp" /applications=yourdomain.com:/:.
/multiplex=True
最后执行运行 Nginx 服务器,我们的 ASP.Net 程序就能脱离 IIS 这个臃肿的家伙运行啦!!!

Zealic 04/01/2010
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: