From d91f26bbe154d25f4f1a64732696d2258f7abd17 Mon Sep 17 00:00:00 2001 From: coolneng Date: Wed, 3 Feb 2021 05:28:10 +0100 Subject: [PATCH] Fix Wallabag service --- modules/information.nix | 13 +++++++++---- modules/webstack.nix | 28 +++++++++++++++++----------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/modules/information.nix b/modules/information.nix index dd7eca9..af34d41 100644 --- a/modules/information.nix +++ b/modules/information.nix @@ -16,12 +16,17 @@ user = "nginx"; group = "nginx"; settings = { - "pm" = "dynamic"; - "pm.start_servers" = 2; + "listen.owner" = config.services.nginx.user; + "listen.group" = config.services.nginx.group; + "listen.mode" = 600; + "pm" = "ondemand"; "pm.max_children " = 4; - "pm.min_spare_servers " = 2; - "pm.max_spare_servers" = 4; "pm.max_requests" = 32; + "env[WALLABAG_DATA]" = "/var/lib/wallabag"; }; + phpEnv."PATH" = lib.makeBinPath [ pkgs.php ]; }; + + # Set environment variable pointing to wallabag configuration directory + environment.variables.WALLABAG_DATA = "/var/lib/wallabag"; } diff --git a/modules/webstack.nix b/modules/webstack.nix index d094959..d1a0c43 100644 --- a/modules/webstack.nix +++ b/modules/webstack.nix @@ -109,18 +109,24 @@ }; }; "wallabag.coolneng.duckdns.org" = { + enableACME = true; + forceSSL = true; root = "${pkgs.wallabag}/web"; - locations."/" = { tryFiles = "$uri /app.php$is_args$args"; }; - locations."~ ^/app.php(/|$)" = { - extraConfig = '' - include ${pkgs.nginx}/conf/fastcgi.conf; - fastcgi_pass unix:/run/phpfpm/wallabag.sock; - fastcgi_split_path_info ^(.+\.php)(/.*)$; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param WALLABAG_DATA /var/lib/wallabag/app; - fastcgi_param DOCUMENT_ROOT $realpath_root; - internal; - ''; + locations = { + "/".tryFiles = "$uri /app.php$is_args$args"; + "/assets".root = "${config.environment.variables.WALLABAG_DATA}/web"; + "~ ^/app.php(/|$)" = { + fastcgiParams = { + SCRIPT_FILENAME = "${pkgs.wallabag}/web/$fastcgi_script_name"; + DOCUMENT_ROOT = "${pkgs.wallabag}/web"; + }; + extraConfig = '' + fastcgi_pass unix:${config.services.phpfpm.pools.wallabag.socket}; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include ${pkgs.nginx}/conf/fastcgi_params; + internal; + ''; + }; }; }; };