Letsencrypt/Nxinx Redirect Error

    • OMV 4.x
    • Letsencrypt/Nxinx Redirect Error

      Hey everyone,

      i tried installing Letsencrypt with Nextcloud with this Video:

      Everything went fine but i'm not able to connect to Nextcloud in any way. Even trying to revert the steps didnt help.
      I dont use duckdns, i registered my own domain at selfhost.de and tried to register the subdomain nextcloud.*.de there, but it doesnt seem to work.
      Do i have to change the subdomain (A-Record) to another Ip eg. XXX.XXX.XXX.XXX:444 (Nextcloud port)?

      Edit: now i get a 502 Error on my nextcloud.*.de and a "The website is currently being setup under this address." if i just try to connect to mydomain.de...

      Thanks for your help! ?(

      The post was edited 1 time, last by Bonecracker ().

    • Not sure how you set up letsencrypt I assume you done the config right so to setup lets say you have a nexcloud.your-domain.de

      cd to you letsencrypt config file

      cd [your config path]/Letsencrypt/nginx/proxy-confs
      open and edit nextcloud.subdomain.conf

      server {
      listen 443 ssl;

      server_name nexcloud.*;

      include /config/nginx/ssl.conf;

      client_max_body_size 0;

      location / {
      include /config/nginx/proxy.conf;
      resolver valid=30s;
      set $upstream_nextcloud LOCALHOST_IP_OF_YOUR_SEVER;
      proxy_max_temp_file_size 2048m;
      proxy_pass https://$upstream_nextcloud:444;

      not sure if this will work
    • This is more or less how you configure nginx from your letsencrypt configuration, the problem for me I either had 502 Bag Gateway or I was hitting the nginx index.html saying something about the server the default page.

      After reading a bit of the nginx documentation, I have learnt that redirects are not actually that hard to do.

      now when you configure nextcloud subdomain or subfolder the trick that after 2 nights wasted on this config was simply solved from changing this line

      set $upstream_nextcloud nextcloud; to set $upstream_nextcloud;

      Just for reference in this case is the local network IP of my server, because letsencrypt is on the same machine. The rest of the tutorial is the same no other things added or changed.

      Can you make your issue a bit more explicit, if you fear for privacy just change the names or censor them, unless I understand how you configured your proxy settings and your nextcloud config.php I can't provide you with any good suggestions.
    • My nextcloud.subdomain.conf looks like this:

      server {
      listen 443 ssl;

      server_name nextcloud.*;

      include /config/nginx/ssl.conf;

      client_max_body_size 0;

      location / {
      include /config/nginx/proxy.conf;
      resolver valid=30s;
      set $upstream_nextcloud;
      proxy_max_temp_file_size 2048m;
      proxy_pass https://$upstream_nextcloud:444;

      But i still only get the default index.html from nginx.
      If you tell me what you need, i can post more configs or logs
    • This is the index.html i am seeing.
      It's the same you find in \Letsencrypt\www

      My default.conf looks like this:

      # main server block
      server {
      listen 443 ssl default_server;

      root /config/www;
      index index.html index.htm index.php;

      server_name *.mydomain.de;

      # enable subfolder method reverse proxy confs
      include /config/nginx/proxy-confs/*.subfolder.conf;

      # all ssl related config moved to ssl.conf
      include /config/nginx/ssl.conf;
      # enable for ldap auth
      #include /config/nginx/ldap.conf;

      client_max_body_size 0;
      location / {
      try_files $uri $uri/ /index.html /index.php?$args =404;

      location ~ \.php$ {
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_index index.php;
      include /etc/nginx/fastcgi_params;

      i think the error is in the location section. nginx tries to find index pages from nextcloud and omv, but cant access them because it's in a docker or sth. But i dont know how to fix it.

      The post was edited 1 time, last by Bonecracker ().

    • ok by the information you have provided so far, here is how the config files should look like.

      Navigate to your letsencrypt config folder /nginx/proxy-confs

      nano nextcloud.subdomain.conf

      paste this code

      Source Code

      1. server {
      2. listen 443 ssl;
      3. server_name nexcloud.*;
      4. include /config/nginx/ssl.conf;
      5. client_max_body_size 0;
      6. location / {
      7. include /config/nginx/proxy.conf;
      8. resolver valid=30s;
      9. set $upstream_nextcloud;
      10. proxy_max_temp_file_size 2048m;
      11. proxy_pass https://$upstream_nextcloud:444;
      12. }
      13. }
      Display All

      Assuming that is the local IP of your omv server

      Now Navigate to your nextcloud config /www/nextcloud/config

      nano config.php

      replace and add the following

      Source Code

      1. 'trusted_domains' =>
      2. array (
      3. 0 => '',
      4. 1 => 'nextcloud.domain.de',
      5. ),
      6. 'overwrite.cli.url' => 'https://nextcloud.domain.de/',
      7. 'overwritehost' => 'nextcloud.domain.de',
      8. 'overwriteprotocol' => 'https',

      'overwrite.cli.url' already exists so remove it and replace it with the above

      after you have done this restart your letsencrypt.

      The post was edited 1 time, last by syrusstk ().

    • Ok, i did that, but still only the index.html from nginx.

      So i think i found the error, but i dont know how to fix it. It is a nginx configuration problem.
      In my understanding, i created a docker image with /AppData/letsencrypt as root directory /config
      So nginx is trying to redirec with

      Source Code

      1. location / {
      2. try_files $uri $uri/ /index.html /index.php?$args =404;
      3. }
      and is searching for omv's and nextcloud's index.php/index.html in /config/nextcloud (which would be /AppData/letsencrypt/Nextcloud, which doesnt exist) or /config/, because it uses the URI Nextloud, and doesn't even have an URI for OMV.
      So i need to redirect it to the root Directory for Nextcloud and omv, which is outside the root path of the container.
      How can i do that? Or am i wrong?

      Thank you for your patient help!

      The post was edited 1 time, last by Bonecracker ().

    • Tried it again today, reinstalling everything, but still no luck... I am certain that I configure sth. wrong but I don't know what... I will have to wait I think...
      Thank you all anyways

      It works now! No idea why it didnt work before, but after reinsalling everything a dozen times, it works now. Thank you all for your help!

      The post was edited 1 time, last by Bonecracker: Error resolved ().