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"匹配不到
分本文转自chy710博客园博客,原文链接:http://www.cnblogs.com/chy710/p/4205466.html
,如需转载请自行联系原作者