ASP.NET MVC on Ubuntu with NGINX

ASP.NET MVC on Ubuntu with NGINX

Phill Luby
9th December 2011

Home Insights ASP.NET MVC on Ubuntu with NGINX

We’ve just published an early working version of an on-line service created by NewRedo, however, although written in ASP.NET MVC 2, it’s not running on a Microsoft server. Instead we’re running on Ubuntu 11.10 using the NGINX web server.

First, a little about the service. It’s a system for booking time off work, and keeping track of the time you’ve booked off. Although it’s in a very early stage, it’s usable right now and we will not lose any data when it finally goes ‘live’. To try this please visit FlitHub.

Ubuntu 11.10 server edition comes comes with very little installed, but by adding just two packages you can have yourself an ASP.NET web server. These packages are installed as follows:

apt-get install nginx mono-fastcgi-server4

This will automatically install Mono if it’s not there already, and it set’s up a web site on port 80. The gory details of the setup can be found on the mono website in their article FastCGI Nginx. However, we opted for a few deviations. For our system, I created a new configuration file in /etc/nginx/sites-available, and hard linked that into /etc/nginx/sites-enabled, just like you would with Apache HTTP Server. Also, rather than editing the installed configuration files, I included the extra fastcgi_param directives in our site configuration file. Upgrades and repairs are slightly easier if you avoid changing configuration files that are provided by the package installation.

I had a little trouble running the FastCGI server with the right parameters. I found that omitting the domain name worked best:

fastcgi-mono-server4 /applications=/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000

I won’t cover getting this all working at start-up as there is a sample script on referenced on the Mono FastCGI article, simply copy this and make the appropriate adjustments. When I get time I hope to write a generic startup script that uses configuration from /etc/fastcgi-mono-server4 to find the websites.

One other consideration was the server memory. We created a cloud-based server with 256MB of memory to see how it would handle the load. After starting the system and hitting a few pages we found that the server is running happily with 33MB spare.

To summarise Ubuntu 11.10 can run ASP.NET applications perfectly well on a small virtual server.

Share Article

Insights.

Exciting News! Agile Yorkshire Shortlisted for Leeds Digital Festival Awards
Exciting News! Agile Yorkshire Shortlisted for Leeds Digital Festival Awards

a community we’ve proudly supported for over a decade

Discover More
Ada Lovelace Day: A Celebration of Women in Tech!
Ada Lovelace Day: A Celebration of Women in Tech!

This event will explore and promote strategies for increasing accessibility to technology careers for individuals from disadvantaged communities.

Discover More
An A-Level Student's First Journey into the World of Work: Jai Soni's Inspiring Week at NewRedo
An A-Level Student's First Journey into the World of Work: Jai Soni's Inspiring Week at NewRedo

“This week has been an eye-opening experience. I’ve learned so much from Alan and the team, not just about engineering but also about how our work can make a real difference. It’s been incredibly inspiring,”

Discover More