0

I'm having issues with an nextcloud instance running on apache (+php-fpm) as a docker container and my nginx reverse proxy.

When I open the Nextcloud URL nginx proxies the request to apache and apache redirect me to /index.php/login. However, for some reason, nginx returns an 404 for /index.php/login.

This is my nginx log:

172.19.0.0 - - [29/Nov/2021:22:32:01 +0000] "GET / HTTP/1.1" 302 0 "-" "Some UA-String"

172.19.0.0 - - [29/Nov/2021:22:32:01 +0000] "GET /index.php/login HTTP/1.1" 404 548 "-" "Some UA-String"

My nginx config:

    server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name cloud.example.com;

    ssl_certificate     [...];
    ssl_certificate_key [...];

    location / {
        proxy_set_header Host $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_buffering off;
        proxy_request_buffering off;
        proxy_http_version 1.1;
        proxy_intercept_errors on;

        proxy_pass http://nextcloud-httpd; #nextcloud-httpd is apaches hostname in the docker network
    }

}

Why does nginx doesn't pass /index.php/login to apache but passes all other requests? Oh and if I'm accessing apache directly everything works, so it have to be the nginx proxy.

Appreciate your help ~anghenfil

anghenfil
  • 11
  • 2

1 Answers1

1

I found the issue! I needed to add the overwriteprotocol option to my nextcloud config to stick to https. Basically every time I got redirected nextcloud redirected me to http, this is an known issue with reverse proxies and a typical RTFM situation: https://docs.nextcloud.com/server/19/admin_manual/configuration_server/reverse_proxy_configuration.html

Best anghenfil

anghenfil
  • 11
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '21 at 18:12