nginx ssl force jump
我想大声告诉你
我想大声告诉你 2017-05-16 17:15:07
0
5
678

nginx makes port 80 forcefully jump to port 443.
Apart from,

server {
   listen      80;
   server_name file.demosite.com;
   return 301 https://file.demosite.com   $request_uri;
}

Is there any other way to force http to jump to https?

我想大声告诉你
我想大声告诉你

reply all(5)
滿天的星座

Isn’t this method good enough?

server {
    listen      80;
    server_name file.demosite.com;
    
    location / {
        rewrite ^/(.*) https://file.demosite.com/ redirect;
    }
}

This is also possible

大家讲道理
server {  
    listen  80;  
    server_name test.com;  
      
    rewrite ^(.*)$  https://$host$1 permanent;  
}  
淡淡烟草味
server {  
    listen  80;  
    server_name xx.com;     
    rewrite ^(.*)$  https://$server_name permanent;  
}  

That’s it.

巴扎黑

How to configure SSL certificate on Nginx (LNMP) and enable forced HTTPS
https://echo.pm/lnmp-nginx-ss...

曾经蜡笔没有小新

HSTS, it’s difficult to type on a mobile phone, so I won’t describe it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template