I am trying to redirect all my traffic from http to https automatically. How can i do a 301 redirect to all my domain and subdomains?
This is N
The default server will accept http connections for any server name (without an explicit server block). Use the $host variable to determine the name of the requested domain.
server {
listen 80 default_server;
listen [::]:80 default_server;
return 301 https://$host$request_uri;
}
See this document for more.