Nextcloud local https does not work

I have a problem that nextcloud works without any problems, nginx also works without any problems, I can access the browser version of nextcloud through nginx also without any problems, but for some reason when I try to run nextcloud in the Android application it just doesn’t want to let me log in, after selecting the addres in the application it continues , but when I try to log in, I get the following error: Strict mode, no HTTP connection allowed!. I tried to find a solution on the Internet but nothing helped. so I tried to set nextcloud to work on https and these are the steps I had to follow, unfortunately each time I turn off the nextcloud container I have to repeat the steps.
first of all, in the default configuration, i.e. in html/config/config.php, I need to change ‘overwriteprotocol’ and ‘overwrite.cli.url’ to https (I don’t know if it actually needs to be set at the beginning because I don’t know if the container needs to be restarted for the changes to take place or if it will work immediately, so I set it and reset container first) then it turned out that there were no default SSL certificates installed in the folder /etc/ssl/certs/. so I had to install ssl-cert and nano (will be useful later). generates new ssl certificates when using “make-ssl-cert generate-default-snakeoil --force-overwrite” then I use two commands to make Apache use SSL certificates “a2ensite default-ssl.conf” and “a2enmod ssl” after completing these commands, there is information “To activate the new configuration, you need to run:
service apache2 restart”
when trying to execute the “service apache2 restart” command, another error appears related to one file from apache related to the fact that it has a variable there and it looked like this “LimitRequestBody ${APACHE_BODY_LIMIT}” and it should have a numerical value, I managed to edit it with the command “nano /etc/apache2/conf-enabled/apache-limits.conf” the file after the change looked like this “LimitRequestBody 0” from what I found, in Apache the value 0 means unlimited. And now I could reset Apache with the “service apache2 restart” command, and everything worked. Of course, the port responsible for https, i.e., in the container, should be port 443.

I did not see this one, so sorry about the late reply.

On the CasaOS, you can set the environment variables:

environment:
      - OVERWRITECLIURL=https://yourdomain.com
      - OVERWRITEPROTOCOL=https
      - APACHE_SERVER_ADMIN=you@example.com
      - APACHE_SSL_CERT=/etc/ssl/certs/ssl-cert-snakeoil.pem
      - APACHE_SSL_CERT_KEY=/etc/ssl/private/ssl-cert-snakeoil.key
  1. Instead of generating SSL certificates every time the container starts, you should mount the certificates from the host machine into the container. This way, they persist across restarts.
  • Create SSL certificates on the host machine:
sudo apt-get install ssl-cert
sudo make-ssl-cert generate-default-snakeoil --force-overwrite
  • Copy the generated certificates to a persistent location on your host:
sudo cp /etc/ssl/certs/ssl-cert-snakeoil.pem /path/to/your/persistent/location
sudo cp /etc/ssl/private/ssl-cert-snakeoil.key /path/to/your/persistent/location