Does not work redirect from http to https for NGINX

I’m use config file for NGINX from this doc and redirect does not work.

Should this be included in some php conf?

That should work. This is what i use with an addition for Lets encrypt renewals.

server {
        listen 80 default_server;
        server_name cloud.my.domain;
        #Your DDNS adress, (e.g. from desec.io or no-ip.com)
        location ^~ /.well-known/acme-challenge {
                proxy_pass http://127.0.0.1:81;
        }
        location / {
                return 301 https://$host$request_uri;
        }
}

Does not work too =(

@whatchamacallit

try $server_ name instead of $host

server {
            listen 80;
            server_name cloud.my.domain;
            # redirect to https
            return 301 https://$server_name$request_uri;
            }
1 Like

Thank’s =)

return 301 https://$host$request_uri;

After that change I had lost connection and with full path (https://servername) writing in adressbar.

ERR_CONNECTION_TIMED_OUT