Nginx 1 · Reverse proxy and TLS
Redirect HTTP to HTTPS
Send every plain HTTP request to the HTTPS version of the same URL.
server {
listen 80;
server_name example.com;
return 301 https://$host$request_uri;
}
Official Nginx 1 documentation