ERR_TOO_MANY_REDIRECTS after Certbot SSL CERT Install

troyboy44

Cadet
Joined
May 27, 2022
Messages
1
Hello,

I'm hoping someone can help me with this error please.
Apparently I have a loop, or something wrong with server blocks according to other peoples posts I have found on the net. I
This is the way certbot installed this and I have no idea how to fix it.
I'm completely new to all of this. How new... Well, it took me 2 days just to be able to find this file. So I have no idea what I'm doing.

This happened after I updated to the latest NextCloud version in Truenas a few days ago.
I wish I had of left it alone tbh.

If you're able to help, please be patient with me as I'm learning.

Thanks in advance :)

Version: TrueNAS-12.0-U8.1

Version: 24.0.0
Plugin: nextcloud
Release: 12.3-RELEASE-p5

This is the nginx nextcloud.conf

Code:
upstream php-handler {
    server unix:/var/run/nextcloud-php-fpm.sock;
}

# Redirect to HTTPS
server {
    listen 80 default_server;
    listen [::]:80;

    location ^~ /.well-known/acme-challenge {
        # Path to the root of your installation
        root /usr/local/www/nextcloud/;
        try_files $uri $uri/ =404;
    }

    location / {
       return 301 https://$host:443$request_uri;
    }
}

server {
    listen 443 ssl http2;
    server_name _;

    # HSTS settings
    # WARNING: Only add the preload option once you read about
    # the consequences in https://hstspreload.org/. This option
    # will add the domain to a hardcoded list that is shipped
    # in all major browsers and getting removed from this list
    # could take several months.
    add_header Strict-Transport-Security "max-age=15768000; includeSubDomains;" always;

    include conf.d/nextcloud.inc;
}

server {

    location ^~ /.well-known/acme-challenge {
        # Path to the root of your installation
        root /usr/local/www/nextcloud/;
        try_files $uri $uri/ =404;
    }

    location / {
       return 301 https://$host:443$request_uri;
    }

    server_name troynas.ddns.net; # managed by Certbot

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /usr/local/etc/letsencrypt/live/troynas.ddns.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /usr/local/etc/letsencrypt/live/troynas.ddns.net/privkey.pem; # managed by Certbot
    include /usr/local/etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = troynas.ddns.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80 ;
    listen [::]:80;
    server_name troynas.ddns.net;
    return 404; # managed by Certbot


}
 
Top