How do I create a SSL redirect?

Solved1.53K views
0

I want to redirect all HTTP traffic to HTTPS. How do I do that?

Question is closed for new answers.
Selected answer as best
1

server {
listen [::]:80;
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}

Selected answer as best