I have setup a LEMP + Varnish server and so far it's working fine. I also have a simple SSL entry point (a NGinx conf long like 2 lines), whose functionality I need to expand. I am not posting my config because... well it's really just a web server declaration + proxy_pass to the non SSL website.
The specifications of what I have to set up are as follows:
1) Whatever subdomain (i.e. http://blog.example.com/) has to be redirected to http:// www.example.com/blog/ - in the most SEO friendly way possible. It'd be golden if the trailing slash would be added in case it's not present.
2) Whatever https URL is called, the website has just to keep working exactly as it'd been called with http.
I.e. http:// www.example.com/pretty_url/ and https:// www.example.com/pretty_url/ have to be equivalent. Since I have the http version working and configured (including W3TC cached wordpress and similar) I have "just" to setup a sister https configuration that mirrors the http one, possibly with proxy_pass or similar.
3) 1) and 2) have to work together (this is also why I post this as own question even if similar things have been asked in the past):
If the user enters:
the Nginx configuration has to transform it into:
and then process it like it was the http version.
Hope the question is understandable enough, else I can post pieces of configuration.
(P.S. I had to put spaces in the URLs else I can't post).