Redirect Http to Https - Nginx with let's encrypt

0

Currently, the domino link is working, but can not redirect link to Link using let's encrypt .

I am following this tutorial: Link

Below my setting:

server {
    listen 80;
    listen 443 ssl;
    server_name meudominio.com www.meudominio.com;


    ssl_certificate /etc/letsencrypt/live/meudominio.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/meudominio.com/privkey.pem;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/ubuntu/project/user;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/ubuntu/project/user/meudominio.sock;
    }
}

server {
    listen 80;
    server_name meudominio.com;
    return 301 https://$host$request_uri;
}
    
asked by anonymous 21.03.2018 / 14:30

1 answer

0

I do it differently:

server {
    listen 80;
    server_name meudominio.com;
    rewrite ^(.*)$ https://$host/$1 permanent;
}

I think if you want to do it this way I think it should look like this:

server {
    listen 80;
    server_name meudominio.com;

    location ~ (.*)$ {
        return 301 https://$host$request_uri;
    }
}

Test there to give us feedback.

    
21.03.2018 / 15:17