git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/nextcloud: fix `nginx`-config for Nextcloud 19 and older

It seems as I misconfigured `nginx` for certain cases such as the `ldap`-plugin[1] in 42f6244899d1ef8839c6e0c0a9340e1334d40264. This patch fixes the `nginx`-config to match the upstream recommendations[2]. Also added a comment to the module to remind myself to ensure that `nginx` will work with both v19 and v20 as soon as the latter is released and can be packaged in `nixpkgs`. Co-authored-by: nivadis <nivadis@users.noreply.github.com> [1] https://github.com/nextcloud/server/issues/16194#issuecomment-688839888 [2] https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html

commit8d8871c565373a46792fc0e4d3976a3c2ac58c18 authorMaximilian Bosch <maximilian@mbosch.me> dateThu 10 Sep 2020, 16:49 (6 years ago) parent1d60af7
1 file changed+5−2
nixos/modules/services/web-apps/nextcloud.nix+5−2
nixos/modules/services/web-apps/nextcloud.nix+5−2
@@ -542,6 +542,9 @@ in {
542542 environment.systemPackages = [ occ ];
543543
544544 services.nginx.enable = mkDefault true;
545+
546+ # FIXME(ma27) make sure that the config works fine with Nextcloud 19
547+ # *and* Nextcloud 20 as soon as it gets released.
545548 services.nginx.virtualHosts.${cfg.hostName} = {
546549 root = cfg.package;
547550 locations = {
@@ -555,7 +558,7 @@ in {
555558 };
556559 "/" = {
557560 priority = 900;
558− extraConfig = "try_files $uri $uri/ /index.php$request_uri;";
561+ extraConfig = "rewrite ^ /index.php;";
559562 };
560563 "~ ^/store-apps" = {
561564 priority = 201;
@@ -579,7 +582,7 @@ in {
579582 "~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)".extraConfig = ''
580583 return 404;
581584 '';
582− "~ \\.php(?:$|/)" = {
585+ "~ ^\\/(?:index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|oc[ms]-provider\\/.+|.+\\/richdocumentscode\\/proxy)\\.php(?:$|\\/)" = {
583586 priority = 500;
584587 extraConfig = ''
585588 include ${config.services.nginx.package}/conf/fastcgi.conf;