title: My redirect from http to https in Nginx not working
body: <pre><code>server {
      listen      80;
      server_name www.21cl.ca 21cl.ca;
      return 301 https://21cl.ca$request_uri;
  }
  
  server {
          server_name 21cl.ca;
          listen 443 ssl http2;
          ssl_certificate /srv/ssl/2100computerlane_net.crt;
          ssl_certificate_key /srv/ssl/21ca.key;
          ssl_protocols TLSv1.2;
          ssl_prefer_server_ciphers on;
          ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
          access_log /srv/www/www.2100computerlane.net/logs/access.log;
          error_log /srv/www/www.2100computerlane.net/logs/error.log;
          root /srv/www/www.2100computerlane.net/public_html;
  
          location / {
                  index index.html index.htm index.php;
                  autoindex on;
                  autoindex_exact_size off;
          }
  
          location ~* \.php$ {
                  include /etc/nginx/fastcgi_params;
                  fastcgi_pass 127.0.0.1:9000;
                  fastcgi_index index.php;
                  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                  fastcgi_param SCRIPT_NAME $fastcgi_script_name;
          }
  }
  </code></pre>
  
  <p><a href="http://www.21cl.ca" rel="nofollow noreferrer">http://www.21cl.ca</a> is being forwarded to <a href="https://www.21cl.ca" rel="nofollow noreferrer">https://www.21cl.ca</a> not <a href="https://21cl.ca" rel="nofollow noreferrer">https://21cl.ca</a> like instructed.</p>
  
  <p>Note this works fine when I do it with my dot net and dot com domains.</p>