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

     

  自 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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值