Nginx Redirect HTTP to HTTPS and non-www to ww
The SSL redirect won’t work if your SSL certificate doesn’t support the non-www domain. The config is correct but can be reduced to just 1 redirect server Also don’t forget to reload Nginx sudo service nginx reload server { listen 80; listen 443 ssl; server_name example.com; # add ssl settings return 301 https://www.example.com$request_uri; }