404 Not Found nginx

Nextcloud version (eg, 20.0.5): 13.1-RELEASE-p9
Operating system and version (eg, Ubuntu 20.04): TrueNAS-13.0-U5.3
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): replace me

The issue you are facing:

When trying to connect to my nextcloud Server via FQDN, I get a “404 Not Found” error.

I want to host a nextcloud Server and for people to access it via FQDN over the internet.
I set up a dyndns with myfritz (Fritzbox as a router). Accessing my TrueNAS system with the same method worked fine.
Before having the 404 error, I used to have a “too many redirect” error in my browser; after I followed a guide on youtube, I changed my nextcloud.conf file and now I am stuck with the current 404 error. It’s important to mention that I only have a IPv6 address to connect to since I have a DS-Light connection. So I absolutely need to use IPv6 here.

I hope this provides enough information and somebody to maybe point me in the right direction;

I didn’t think it would be so difficult to get this to just work ^^’

Thanks a lot to anyone who reads this and is willing to help out!

Steps to replicate it:

  1. Make Self signed Certificate
  2. Change the /usr/local/etc/nginx/conf.d/nextcloud.conf file
  3. Connect to nextcloud via the FQDN

The output of /usr/local/etc/nginx/conf.d/nextcloud.conf:

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

# Redirect to HTTPS
server {
#   listen 80 default_server;
#   listen [::]:80;
    listen              0.0.0.0:443 default_server ssl http2;
    listen              [::]:443 default_server ssl http2;
    ssl_certificate     "/usr/local/etc/ssl/nginx/nextcloud.crt";
    ssl_certificate_key "/usr/local/etc/ssl/nginx/nextcloud.key";
	
    ssl_session_timeout 120m;
    ssl_session_cache   shared:ssl:16m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    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 nextcloud.*;

    # HSTS settings
    # WARNING: Only add the preload option once you read about
    # the consequences in https://hstspreload.org/. This option
	   server_name nextcloud.*;
	 ver {
#      listen 443 ssl http2;
       server_name nextcloud.*;

    # 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;
}