Page 1 of 1

http2.tpl file to force https

Posted: Fri Apr 12, 2019 1:29 pm
by edica
Hi,

I changed the http2.tpl file to force https. But it does not go to https. what's wrong?

server {
listen %ip%:%proxy_ssl_port% http2;
server_name %domain_idn% %alias_idn%;

location / {
return 301 https://%domain%$request_uri;
}

include %home%/%user%/conf/web/snginx.%domain%.conf*;

}

Re: http2.tpl file to force https

Posted: Thu Apr 18, 2019 9:06 pm
by dreiggy
I don't works for existing domains or for new one?

Mhmm maybe try change like this:

location / {
return 301 https://%domain_idn%$request_uri;
}

PS. After template change, you need to rebuild vhosts:

Code: Select all

for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user; done

Re: http2.tpl file to force https

Posted: Fri Apr 19, 2019 10:30 pm
by grayfolk
edica wrote:
Fri Apr 12, 2019 1:29 pm
Hi,

I changed the http2.tpl file to force https. But it does not go to https. what's wrong?

server {
listen %ip%:%proxy_ssl_port% http2;
server_name %domain_idn% %alias_idn%;

location / {
return 301 https://%domain%$request_uri;
}

include %home%/%user%/conf/web/snginx.%domain%.conf*;

}

Code: Select all

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;

    location / {
        return 301 https://%domain_idn%$request_uri;
    }

        include %home%/%user%/conf/web/snginx.%domain%.conf*;

}