Nginx-proxy-manager: Nextcloud Nginx Conf

Created on 6 Jun 2020  路  3Comments  路  Source: jc21/nginx-proxy-manager

How can I add the nginx conf example from nextcloud docs? https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html

when I add most of this in advanced in webui it works.

but when I add some things wich contains locations I don't get it to work:

    location / {
        rewrite ^ /index.php;
    }

    location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
        deny all;
    }
    location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny all;
    }

    location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
        fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
        set $path_info $fastcgi_path_info;
        try_files $fastcgi_script_name =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;
        # Avoid sending the security headers twice
        fastcgi_param modHeadersAvailable true;
        # Enable pretty urls
        fastcgi_param front_controller_active true;
        fastcgi_pass php-handler;
        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;
    }

    location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
        try_files $uri/ =404;
        index index.php;
    }
    location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
        try_files $uri /index.php$request_uri;
        # Optional: Don't log access to other assets
        access_log off;
    }

this all. seems not to work for me :/ (as an example)

product-support

Most helpful comment

How can I add the nginx conf example from nextcloud docs? https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html

when I add most of this in advanced in webui it works.

this all. seems not to work for me :/ (as an example)

I am running Nextcloud ver 19
This is what works for me in NPM:

  • Turn on Websockets
  • Force SSL
  • HSTS Enabled
  • HTTP/2

In Advanced

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

With this setting I got no security errors/warnings in NC->Settings->Admin->Security & setup warnings

All 3 comments

and why would you try to add those locations on first place?!

It's a reverse proxy it means it doesn't require any extra config for custom scripts like wordpress, laravel, nextcloud, etc.

This is the same as cloudflare nothing is different for as time as you are doing only reverse proxy with this you don't have to apply any extra config or search "nextcloud nginx config" only because you are using nginx.

You aren't using nginx for a web server you are using nginx for reverse proxy so don't add any kind of extra nginx config

here's my example totally working fine https://*.nl and i don't have any kind of custom locations as you're trying to do on my nginx proxy manager.

How can I add the nginx conf example from nextcloud docs? https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html

when I add most of this in advanced in webui it works.

this all. seems not to work for me :/ (as an example)

I am running Nextcloud ver 19
This is what works for me in NPM:

  • Turn on Websockets
  • Force SSL
  • HSTS Enabled
  • HTTP/2

In Advanced

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

With this setting I got no security errors/warnings in NC->Settings->Admin->Security & setup warnings

In my case, I was still getting an error but after removing the :$server_port it worked. I am assuming this is because the proxy host is already port forwarding when accessing /remote.php/dav

Putting this under Advanced worked for me:

location = /.well-known/carddav {
  return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
  return 301 $scheme://$host/remote.php/dav;
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Trrw picture Trrw  路  3Comments

sudvej picture sudvej  路  5Comments

obxjames picture obxjames  路  6Comments

edouardkleinhans picture edouardkleinhans  路  6Comments

dgeordgy21 picture dgeordgy21  路  3Comments