Nextcloud Too Many Redirects

micahw

Cadet
Joined
Aug 11, 2022
Messages
1
Good Afternoon! I'm having issues getting past a "too many redirects" on my FQDN.

So far I have:
Installed nextcloud successfully
Am able to access the local interface at static IP of 10.0.0.8
Succesfully gotten SSL thru Certbot/Lets Encrypt for my domain cloud.wagoner.tech
When I go to the domain, I receive a "ERR_TOO_MANY_REDIRECTS" in chrome.

I understand the error, in that the server keeps redirecting in a loop, where the browser never reaches an actual page. But, I can't figure out how to break this loop.

I have seen others having issues with Cloudflare, however I do not use cloudflare, so none of those solutions apply here. I suspect it has to do with my nextcloud.conf file, but I cannot quite figure out the correct settings. I have pasted it below.


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://$server_name$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 cloud.wagoner.tech; # managed by Certbot

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /usr/local/etc/letsencrypt/live/cloud.wagoner.tech/fullchain.pem; # managed by Certbot
    ssl_certificate_key /usr/local/etc/letsencrypt/live/cloud.wagoner.tech/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 = cloud.wagoner.tech) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80 ;
    listen [::]:80;
    server_name cloud.wagoner.tech;
    return 404; # managed by Certbot


}


I appreciate any suggestions from the community.

Thanks, Micah
 
Top