Nginx - rewrite HTTP to HTTPS

A simple code snippet that can be used to rewrite HTTP request to HTTPS.

server {
	listen 80 default_server;
	server_name www.sleeplessbeastie.eu;
	return 301 $scheme://blog.sleeplessbeastie.eu;
}	

Sources

Nginx Pitfalls - Taxing Rewrites