Problems with Nginx https configuration

now I have transferred all access to port 80 to port 443. I have no experience. I would like to ask you, is it safe to configure in this way? You won"t get caught with plaintext communications before jumping to port 443, will you?

 server {
        listen 80;
        server_name www.mine.com;
        rewrite ^(.*)$ https://www.mine.com;
    }
 server {
       listen       443 ssl http2 default_server;
       listen       [::]:443 ssl http2 default_server;
       server_name  www.mine.com;
       root         /www;
Jun.04,2021

if you need to implement a forced jump https, it is recommended to use 301 return, which is considered to be the best practice for upgrading from http to https.

 server {
    listen 80;
    server_name www.mine.com;
    //rewrite ^(.*)$ https://www.mine.com;
    return 301    https://www.mine.com;
}

for more information, please see wiki
https://en.wikipedia.org/wiki.

.
Menu