Force HTTPS not working

Keywords: WordPress + NGINX + SSL - AWS - Technical issue - Secure Connections (SSL/HTTPS)

bnsupport ID: 8075c244-05a8-ee27-73ae-679af892675e

bndiagnostic output:

? Nginx: Found possible issues
? Resources: Found possible issues
https://docs.bitnami.com/installer/infrastructure/nginx/troubleshooting/

bndiagnostic failure reason: The documentation did not make any significant change

Description:
I did try this example from the documentation https://docs.bitnami.com/bch/apps/wordpress-pro/administration/force-https-nginx/ and after restarting Nginx it still didn’t work, I also tried via .htacess without good results.

my wordpress-server-block.conf is the following:

server {
    listen 80;
    server_name localhost;
    return 301 https://$host$request_uri;
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
    location /apple-app-site-association {
        default_type application/json;
    }
    location /.well-known/apple-developer-merchantid-domain-association {
        allow all;
        autoindex on;
        root /var/www/example.com/html;
        add_header Content-Type text/plain;
    }
    include  "/opt/bitnami/nginx/conf/bitnami/*.conf";
}

Hello @joan.albert,

It seems you haven’t made all the necessary changes explained in the guide. For the file /opt/bitnami/nginx/conf/server_blocks/wordpress-server-block.conf you need to modify the server block listening on port 80 so contains the following:

  server {
      listen 80 default_server;
      root /opt/bitnami/APPNAME;
      return 301 https://$host$request_uri;
....

Then, you need to also modify /opt/bitnami/nginx/conf/nginx.conf and leave the server block using port 80 with these lines:

  server {
        listen 80;
        server_name localhost;
        return 301 https://$host$request_uri;
...

Could you please double-check your changes and restarting NGINX after that?

Regards,
Francisco de Paz

Hello @fdepaz,

I did all the new configs but still didn’t work out, I rerun the diagnostic tool so maybe you can check again what can be failing, new bundle ID is 682058f1-f215-245f-1502-bb4bea2526be .

Thanks a lot in advance,

Joan

Hello @joan.albert,

That is a bit strange. Just to cross out possible issues, did you open port 443 as explained here:

https://docs.bitnami.com/aws/faq/administration/use-firewall/

Also, did your restart your NGINX process after making the changes executing:

sudo /opt/bitnami/ctlscript.sh restart nginx

Regards,
Francisco de Paz

Hi @fdepaz,

I did run sudo /opt/bitnami/ctlscript.sh restart nginx and I already have port 443 opened since the beginning since I’m already accepting https I just one to redirect from 80 http to 443 https. I will try to do it from my load balancers if this doesn’t work.

Hello @joan.albert,

Oh, I was missing your use of a Load Balancer. If you have one configured here, that could indeed be causing the issues, as the redirecting policies are managed by it. I recommend you to use the LB to configure the redirection in this scenario.

Regards,
Francisco de Paz

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