简体   繁体   中英

My redirect from http to https in Nginx not working

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;
        }
}

http://www.21cl.ca is being forwarded to https://www.21cl.ca not https://21cl.ca like instructed.

Note this works fine when I do it with my dot.net and dot com domains.

I think it has been cached in the browser try it in private or incognito window, It is redirecting properly for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM