How to deploy a self contained .NET Core app.

in ASP.NET MVC
by Mahmut Jomaa on June 27, 2016
mnwall-separatormnwall-separator
Ok this blog post is rather a duplicate of the docs. However many people wrote me an e-mail because they simply didn't find it.   Docs: https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index   1. Change the…

.NET Core 1.0 got released

in News
by Mahmut Jomaa on June 27, 2016
mnwall-separatormnwall-separator
Today is the day. Microsoft announced something sweet at Red Hat DevNation. After a 3 year long journey .NET Core 1.0 got released: https://blogs.msdn.microsoft.com/dotnet/2016/06/27/announcing-net-core-1-0/     1. Get the Visual…

Microsoft aquired Xamarin

in News
by Mahmut Jomaa on February 25, 2016
mnwall-separatormnwall-separator
Microsoft announced today that they aquired Xamarin. This is HUGE!   About Xamarin Xamarin is a provider for mobile app development technology. You can write a C# application and cross-compile…

Building a simple Brainfuck Interpreter in C

in C/C++
by Mahmut Jomaa on December 08, 2015
mnwall-separatormnwall-separator
Brainfuck is a Turing-complete language that isn't necessary designed for productive usage :) However it is actually great to understand C pointers. An Interpreter is a computer program that directly…

How to enable precompiled razor views (.cshtml) in ASP.NET 5

in ASP.NET MVC
by Mahmut Jomaa on November 29, 2015
mnwall-separatormnwall-separator
If you want your .cshtml to be precompiled before the first request hits, you need to enable it manually. This increases time needed for compilation, however the compilation process still…

Upgrading your ASP.NET 5 application from beta8 to RC1

in ASP.NET MVC
by Mahmut Jomaa on November 23, 2015
mnwall-separatormnwall-separator
There aren't that many API changes, the focus on RC1 was to stabilize the code base.   Installation of RC1: 1. First download and install the RC1 upgrade for Visual…

Pasterino.com

in Projects
by Mahmut Jomaa on November 09, 2015
mnwall-separatormnwall-separator
Today I'm releasing a new online tool: pasterino.com In short: You can store text online or use it as your syntax highlghter (for your blog).   Features: Paste and share…

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

Series:

 

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 127.0.0.1. So our address is actually http://127.0.0.1:5001

 

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

 

Congratulations!



Mahmut Jomaa is a Software Engineer from Germany.

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


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

 

Because insights are awesome!