What is Nginx

Nginx (“engine x”) is a high-performance HTTP server and reverse proxy. Designed not just as a typical web server but also to proxy requests, proxying to FastCGI is second nature to Nginx and can be done in just a few short lines of configuration.

Installing Nginx on Ubuntu

Nginx web server installation (with root):

apt-get install nginx

Nginx configuration

Nginx configuration (as of version 0.7.63) is located in /etc/nginx/nginx.conf (which contains http configuration) and in /etc/nginx/sites-available/default (where is configuration of particular virtual host or hosts). In order to setup ASP.NET or ASP.NET MVC web application, you need to modify virtual host configuration.

 server {
         listen   80;
         access_log   /var/log/nginx/;

         location / {
                 root /var/www/;
                 index index.html index.htm default.aspx Default.aspx;
                 fastcgi_index Default.aspx;
                 include /etc/nginx/fastcgi_params;

ASP.NET and ASP.NET MVC web applications runs on Nginx through FastCGI protocol, therefore you need to add few lines into /etc/nginx/fastcgi_params.

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

Now the Nginx part is complete, but to finish the whole thing Mono FastCGI server needs to be started.

 fastcgi-mono-server4 / /socket=tcp:

Now when Mono FastCGI server is up and running, Nginx configuration is complete and your application is in place (located in /var/www/ you can run the web server.

 /etc/init.d/nginx start

Useful resources
Linux startup script for mono FastCGI server