Score:0

Multiple NextCloud instances behind NGINX Reverse Proxy

in flag

Currently I have a NGINX proxy running that manages all domains and SSL certificates.

Now I want to access two NextCloud instances on one server (Apache, different paths) via different subdomains.

Eg.

app1.domain.com => http://ip-adress/nextcloud/instance1

app2.domain.com => http://ip-adress/nextcloud/instance2

On the Apache web server, I can access the applications directly via the path.

Proxy Config (foreach subdomain):

server {
    server_name app1.domain.com
    
    # HTTP configuration
    listen 80;
    listen [::]:80;
    
    

    location / {
        proxy_pass  http://ip-adress:80;
        proxy_redirect                      off;
        proxy_set_header  Host              $http_host;
        proxy_set_header  X-Real-IP         $remote_addr;
        proxy_set_header  X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header  X-Forwarded-Proto $scheme;
        proxy_read_timeout                  900;
    }
}

SSL will later be managed by Certbot.

If the proxy_pass is set to the adress (like in the snippet), I can access the site under app1.domain.com/nextcloud/instance1

If the proxy_pass ist set to "http://ip-adress:80/nextcloud/instance1" I get directed to /index.php (which would be correct) but an 404.

If the proxy_pass ist set to "http://ip-adress:80/nextcloud/instance1/" I get directed to /nextcloud/instance1/index.php/login" but also an 404.

Where ist the mistake?

HBruijn avatar
in flag
When using the default ports for HTTP (or HTTPS for that matter) you should not include a port number in the URI , in other words: when accessing a web server over plain http on the default port 80, do not use `http://ip-adress:80/nextcloud/instance1` but `http://ip-adress/nextcloud/instance1` - https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.3
Patrick avatar
in flag
Hi, thanks for the information and the link! But unfortunately this doesn't change anything.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.