Nginx Redirect HTTP to HTTPS
Redirecting HTTP-Traffic to HTTPS is easy with this simple configuration:
server {
listen 80;
server_name example.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443;
server_name example.com;
...