Redirect any subdomain http or https to a single subdomain with NGINX

Today I had a use case where I wanted to redirect any subdomain at any scheme (http or https) to a single https subdomain https://ping.flenny.net. http://blog.flenny.net should redirect to https://ping.flenny.net https://www.flenny.net should redirect to https://ping.flenny.net In order to redirect both schemes (http and https) to a single subdomain you have to setup two server blocks. […]