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 II: Fundamental Settings

Series:

 

1. Enable gzip compression

We tell nginx that it should compress certain files with gzip before sending them out. This gives us a huge performance gain!

Open the global setting file:

Move down and enable gzip by uncommenting and adding a few lines if necessary, e.g.:

(Note: if you don't want this to be a global setting, you can create a conf file in /etc/nginx/conf.d/)

 

2. Enable Browser Caching

We configure nnginx to set some meta information into certain headers, so the browser just need to download files when they've changed or are expired. Again, a huge performance gain!

Open your site config:

Setting up a cache :

Note: Go to /var/cache/nginx and see if there is a tmp folder. If not, create one!

Setting up rules:

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

 

3. URL / IP Canonicalization

If the URL www.yourdomain.com and yourdomain.com and the server IP adress xxx.xxxx.xxx.xx don't resolve to the same URL, you will get double content. Not only you'll score worse in search engines, but in case of an attack you have to fight on 3 different fronts. It's quite simple to avoid that. In this case we redirect the other addresses to yourdomain.com

Open your site config:

Redirect the other server blocks to the main scheme:

 

4. Optional: Set a custom header

If you want to hide nginx in the response header (you should), you can overwrite it. Unfortunately the module is not distributed with the nginx source, so we need to install it first.

Install the ngx_headers_more module:

Open your site config:

Set your header:

 

5. Example file:

It lacks some stuff (e.g. ssl), but for the beginning .. not bad!

 

6. (Re)start nginx:

The changes we've made take place when we restart nginx.



Mahmut Jomaa is a Software Engineer from Germany.

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


Security code Refresh

 

Because insights are awesome!