Jump to content
Sign in to follow this  

Issue with reverse-proxying nextcloud

5 posts in this topic Last Reply

Recommended Posts



Not really sure where to post this issue I'm having. 


I'm trying to reverse-proxy my (linuxserver.io) Nextcloud container using Nginx Proxy Manager but it doesn't work. 


The Nextcloud docker is running on port 443 only (I'm not managing to just have it on port 80 through the conf-file), which messes with Nginx Proxy Manager since that wants to handle the redirect as I understand it. Any ideas? I've tried adding another Host port 80 in the docker settings in Unraid and adding:


server {
    listen 80;
    listen [::]:80;
    server_name storage.*;
    return 301 https://$host$request_uri;

to the nextcloud dockers Nginx/site-confs/default, but no luck.


I'm running Authelia infront of the address as a (at least perceived) layer of security, if that helps, but Authelia works as it should.


Have I forgotten any information that might be necessary to assist?


EDIT: Running all dockers with own its on br0-network.








Edited by muppie

Share this post

Link to post

This is working for me:


### nextcloud
server {
        listen 443 ssl;
        server_name nextcloud.domainname.com;
        client_max_body_size 20G;
	add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";

        location / {
              proxy_max_temp_file_size 2048M;
	      proxy_buffering off;
              proxy_read_timeout 256;

    location = /.well-known/carddav {
      return 301 $scheme://$host:$server_port/remote.php/dav;
    location = /.well-known/caldav {
      return 301 $scheme://$host:$server_port/remote.php/dav;



Share this post

Link to post

I must have read the support thread a hundred times a day but I now found this solution: Now I just need to try it.


On 12/21/2018 at 7:14 PM, Djoss said:

@amacdonald, currently, Nginx Proxy Manager doesn't have the support for forwarding to a HTTPs backend/server.


In the meantime, if you really want to have your nexcloud forwarding working, you can manually edit the generated Nginx config to make your proxy works:

In /mnt/user/appdata/NginxProxyManager/nginx/proxy_host/, find the file associated to nextcloud. You then need replace the directive "include conf.d/include/proxy.conf" with:

add_header       X-Served-By $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto  $scheme;
proxy_set_header X-Forwarded-For    $remote_addr;
proxy_pass       https://$server:$port;

Finally, restart the container.

Note: if you do a change from the UI, the config file will be overwritten and you will loose your changes!

Share this post

Link to post
1 hour ago, muppie said:



Just a follow-up, the ip (, is that something I need to change to match an ip on my network?

Yes. It’s the ip of your Nextcloud host. 

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this