首页 > Web开发 > 详细

Nginx运行Mono Web (ASP.NET)

时间:2015-01-06 11:20:05      阅读:445      评论:0      收藏:0      [点我收藏+]

Mono Web除了可以使用Apache/mod_mono方式承载运行外,还可以使用Nginx/FastCGI方式运行。

Nginx配置asp.net更简单方便,用处也多,可以通过FastCGI运行asp.net, php等,通过反向代理做负载均衡,也可运行python web.

以Ubuntu为例

配置nginx (/etc/nginx/sites-available/default),让站点根目录以FastCGI方式运行

server {
    listen 80;
    root /usr/share/nginx/www;
    index index.html index.htm;

    server_name localhost;
    access_log /var/log/nginx/chat.log;

    location / {
        root /var/www/chat;
        index default.aspx default.html;
        fastcgi_index Default.aspx;
        fastcgi_pass 127.0.0.1:8099;
        include /etc/nginx/fastcgi_params;
    }
}

编辑/etc/nginx/fastcgi_params

fastcgi_param    PATH_INFO        "";                        
fastcgi_param    SCRIPT_FILENAME        $document_root$fastcgi_script_name;

安装fastcgi-mono-server4模块

apt-get install fastcgi-mono-server4

运行FastCGI Mono

fastcgi-mono-server4 /applications=/:/var/www/chat/ /socket=tcp:127.0.0.1:8099
# just via domain visit
fastcgi-mono-server4 /applications=www.domain.com:/:/var/www/chat/ /socket=tcp:127.0.0.1:8099

 

注:applications={URL访问地址Path}:{物理路径},与上面的nginx config一致,URL访问地址可以使用域名。如此地址配置错误,会报异常"No Application Found"匹配不到

Nginx运行Mono Web (ASP.NET)

原文:http://www.cnblogs.com/chy710/p/4205466.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!