After installing SSL certificate, Port 80 doesn't automatically get redirected to 443

Hello everybody,

I installed an SSL certificate with let’s encrypt:

The installation of the certificate worked without problems and accessing the site via HTTPS works great.

For this to work I also activated the DNS based multitenancy:

What doesn’t work is the automatic redirect from Port 80 to Port 443.

My file “/etc/nginx/conf.d/frappe-bench.conf” (which was generated automatically) contains the following block at the end:

        server {
                listen 80;

                return 301 https://$host$request_uri;

But at the start of the file, another block for the same URL on port 80 was generated which causes the redirect to not work.

Yes, I could manually edit this file and remove the problematic block (which I already tried of course).
BUT: the file got generated through executing “bench setup nginx”, and each execution of this could overwrite my manual edits.

So, why does bench generate two entries for my URL for port 80 at all and what can I do to circumvent this without editing the generated config files manually?
Did I do something wrong when creating the site?
There is no nginx-port set in the “site_config.json” btw.

Thanks in advance

Well, I found out why this didn’t work as expected.

As it turns out I did this once:

bench setup add-domain <my-real-url>.com --site <my-site-name>

This created the following lines in my “site_config.json”:

"domains": [

I gues that this was the reason that the extra entry for port 80 was generated.

I removed this manually (why is there no bench command for removing it?), executed “bench setup nginx” again and the superfluous entry in “/etc/nginx/conf.d/frappe-bench.conf” wasn’t automatically generated anymore.



This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.