Nginx運行Mono Web (ASP.NET)

來源:互聯網
上載者:User

標籤:

Mono Web除了可以使用Apache/mod_mono方式承載運行外,還可以使用Nginx/FastCGI方式運行。

Nginx配置asp.net更簡單方便,用處也多,可以通過FastCGI運行asp.net, php等,通過反向 Proxy做負載平衡,也可運行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 visitfastcgi-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)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.