Nextcloud after SSL with Certbot too many redirects

HI I have installed SSL with

certbot --nginx -d

Now each time I try to connect to my cloud from outside i get Too many redirects error. I used the below method. Can anyone see why this is not working now as it used to work last year on my old server then after it went and replacing with the new one and replicating all settings it is now failing.

as root, SUDO permitted

iocage console nextcloud

cp /usr/local/www/nextcloud/config/config.php


ee /usr/local/www/nextcloud/config/config.php

add trusted domains , copy the line and add the domain you desire

To begin, fetch a compressed snapshot of the ports tree:

portsnap fetch

It may take a few minutes for this command to complete. When it finishes, extract the snapshot:

portsnap extract

Next, navigate to the py-certbot-nginx directory within the ports tree:

cd /usr/ports/security/py-certbot-nginx

Run the make command from this directory. This will install the nginx plugin for Certbot which we’ll use to obtain the SSL certificates:

sudo make install clean

Certbot provides a variety of ways to obtain SSL certificates through various plugins. The nginx plugin will take care of reconfiguring Nginx and reloading the config file:

certbot --nginx -d ( this is where you list your domain )

To test the renewal process, you can do a dry run with Certbot:

certbot renew --dry-run

If you see no errors, you’re all set to create a new crontab:

crontab -e

This will open a new crontab file. This is a vi text editor,
press I to enter insert mode and navigate to the end of
renew_certificates. Press Enter and add the following
content to the new file, which will tell cron to run the
certbot renew command twice every day at noon and midnight.
certbot renew checks whether any certificates on the system
are close to expiring and will attempt to renew them when necessary:

0 0,12 * * * /usr/local/bin/certbot renew

After this access to the site will crash , this is the fix

Open your nginx.config file using the below command:

ee /usr/local/etc/nginx/nginx.conf

Change the path to the letencrypt folder where your certificate,
key, and trusted certificate are saved.

under line SSL change word truenas to ( this is your domain name)

Test the changes by restarting the nginx service:

service nginx restart

Refresh your browser after you restart Nextcloud jail. If you have done everything correctly,
you should be able to access your Nextcloud login portal at this point:

Additional point, after ssh as root had to edit RC.conf for Firewall access settings

Open up your rc.conf file, which is located in the /etc/ directory, with your preferred editor. Here we will use ee:

sudo ee /etc/rc.conf

This file is used to inform FreeBSD which services should be started whenever the machine boots up. Near the top of the file, add the following highlighted lines:

. . .
firewall_myservices=“22/tcp 80/tcp 443/tcp”

I would really appreciate some helpw.

I appreciate you were trying to provide some context, but most of that info isn’t necessary and is a lot to wade through for someone trying to help you out. And, unfortunately, it lacks other key info. I think that’s why you didn’t get response. Let’s try this a different way:

  • Are you using a reverse proxy?
  • What is your Nginx configuration?

Do you use Cloudflare?

Try creating a Let’s Encrypt SSL by verifying your domain using DNS and see how it goes.