nginx: Split http and https server settings
To configure nginx properly and for best performance it is needed to have the server block of one domain split into the http and https part.
Please see:
http://wiki.nginx.org/Pitfalls
http://serverfault.com/a/337893/216241
http://www.jafaloo.com/https-to-http-redirection-in-nginx/
At the moment we have to use a Rewrite Rule with an if-statement:
if ( $scheme = "http" ) {
return 301 https://$host$request_uri;
}
This could easily be avoided in nginx to improve performance and elegance nonetheless.