Nginx server { listen 80; return 301 https://$host$request_uri; } server { listen 80; listen 443 ssl; server_name example.com; return 301