2

I'm pretty unexperienced using reverse proxy, so my question can be really lame, sorry for that.

I'm trying to reach my owncloud server through nginx reverse-proxy, but it can't load perfectly.

I have an NGINX reverse-proxy server using multiple locations. I would like to make a new public access to my owncloud server located in another machine with apache. I would like to use _https://my_public_url/owncloud_ to reach my owncloud server, so I made the location block like this:

Whem I'm using

location / {
    proxy_pass http://my_owncloudserver_url/;

everything is fine.

But in this case:

location /owncloud/ {
    proxy_pass http://my_owncloudserver_url/;

I get the index.php/login page without any formatting, as /apps, /core, etc. requests are still requested from "https://my_public_url/apps/...", "https://my_public_url/core/...", etc. instead of "https://my_public_url/owncloud/core/..." where the files are located, as these requests don't match with /owncloud/ location and aren't proxied.

I guess I should use rewrite to change the urls of these requests, putting the "/owncloud/" part into the url.

If I'm using a separate location to match with "/core/..." requests, like:

location /core/ {
     rewrite  ^/core/(.*)$ /owncloud/core/$1 permanent;
}

then it seems to be OK, but I won't make a lot of different locations to match with all various requests.

How could I fix this? I'm running out if ideas, although it must be pretty easy.

Thanks, sanglee

sanglee
  • 21
  • 2

2 Answers2

0

I'm not sure about Owncloud. But in Nextcloud you have to configure some proxy parameters in the config.php https://docs.nextcloud.com/server/16/admin_manual/configuration_server/config_sample_php_parameters.html#proxy-configurations Please consider to use Nextcloud because it is faster than Owncloud, if fully open source, more features and is actively maintained by the community.

Darwiche
  • 39
  • 1
0

Update OWNCLOUD_SUB_URL” to “/owncloud” when running the container, or find the subtitute config if running not using containers

And on nginx config

location /owncloud {
    proxy_pass http://my_owncloudserver_url/owncloud;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_redirect off;
    proxy_buffering off;
}
Ardi Nusawan
  • 427
  • 6
  • 12