P_heck
Basic Pleskian
Hello!
I have searched for a solution, but didn't found one - so if this question has already been answered, please just direct me to the thread.
12.5.30 Update #47 running on Debian Wheezy, using NGINX with fpm-php on PHP 7.0.10
I have now updated all my customer websites to SSL using the Let's Encrypt extension which works fine.
Now I want to redirect all http traffic to https. First try was to use the following statement:
This one works fine for the redirect, but breaks the renewal of certificate within the Let's Encrypt extensions as it looks at http and seems not to follow the redirection. Error code I got (customer data blacklisted):
I also tried to put the following directive in the Plesk Panel:
But got the error, that I can't define the root ("/") location as it's already defined.
Don't think it's a good idea to edit the nginx.conf file by myself as Plesk will revert the change at the next update.
In the meanwhile, I'm using below statement, which only redirects the root to https, but I'm not happy with it as it still allows unencrypted traffic outside the root directory.
So anybody has an idea, how to redirect all http traffic to https but not the one for "/.weel-know/acme-challenge" ?
Cheers Peter
I have searched for a solution, but didn't found one - so if this question has already been answered, please just direct me to the thread.
12.5.30 Update #47 running on Debian Wheezy, using NGINX with fpm-php on PHP 7.0.10
I have now updated all my customer websites to SSL using the Let's Encrypt extension which works fine.
Now I want to redirect all http traffic to https. First try was to use the following statement:
Code:
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
This one works fine for the redirect, but breaks the renewal of certificate within the Let's Encrypt extensions as it looks at http and seems not to follow the redirection. Error code I got (customer data blacklisted):
Code:
Domain: domain.tld
Type: unauthorized
Detail: Invalid response from http://domain.tld/.well-known
/acme-challenge/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[xxx.xxx.xxx.xxx]: 404
I also tried to put the following directive in the Plesk Panel:
Code:
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /path/to/your/root/dir;
}
location / {
return 301 https://$server_name$request_uri;
}
But got the error, that I can't define the root ("/") location as it's already defined.
Don't think it's a good idea to edit the nginx.conf file by myself as Plesk will revert the change at the next update.
In the meanwhile, I'm using below statement, which only redirects the root to https, but I'm not happy with it as it still allows unencrypted traffic outside the root directory.
Code:
if ($request_uri = /) {
set $test A;
}
if ($scheme = 'http') {
set $test "${test}B";
}
if ($test = AB) {
rewrite ^/(.*)$ https://domain.tld/$1 permanent;
}
So anybody has an idea, how to redirect all http traffic to https but not the one for "/.weel-know/acme-challenge" ?
Cheers Peter