How to combine nginx + Kestrel for production Part I: Installation



ASP.NET 5 is a new framework from Microsoft. Goals of that framework:

  • Cross platform
  • Cloud optimized if needed
  • Getting rid of the System.Web overhead. Achieved through 1) modularization 2) everything new will be - if possible - asynchronous 3) Dependency Injection


On Windows we can use IIS to host our application.

On Linux we are using Mono + KestrelHttpServer which is based on libuv.


The problem we face is that Kestrel is a development server, so if we want to use Kestrel in production we miss a lot of features. For example Virtual Hosts.

But we don't have to! Nginx and Kestrel work together like a charm.


So let's get started:


I assume that you have a working mono environment installed. If not, click here.

In our project.json of our test project we mapped the address to http://localhost:5001

Usually the default host file routes localhost to So our address is actually


0. Stop your application in the background:

(You can get the process id with ps -ef


1. First we need to install nginx:


2. Then we need to configure a virtual host, so nginx works as a reverse proxy:


(Save with CTRL+O and Exit with CTRL+X)


3. Remove the default config file:


4. Enable your nginx site:


5. (Re)start nginx:


6. Start your application:

(Note: We redirect (save) the output-stream into the file error.log



Mahmut Jomaa is a Software Engineer from Germany.

Currently he attends university to gain more knowledge in Computer Science.

+2 # This is awesome 2015-06-11 17:52 – VSK
Thank you, it works great!
Reply | Reply with quote | Quote
Security code Refresh