diff --git a/modules/web-apps/wordpress/module.nix b/modules/web-apps/wordpress/module.nix index 9d5b2bb..4bb5d7f 100644 --- a/modules/web-apps/wordpress/module.nix +++ b/modules/web-apps/wordpress/module.nix @@ -25,6 +25,9 @@ in { disabledModules = [ "services/web-apps/wordpress.nix" ]; options.services.wordpress = { enable = mkEnableOption "Enable the WordPress module"; + domain = mkOption { + type = types.str; + }; wpConfigSecrets = mkOption { type = types.str; }; @@ -55,8 +58,21 @@ in { additionalModules = with pkgs.nginxModules; [ dav cache-purge moreheaders ] ++ optional cfg.enablePageSpeed pagespeed; - # httpConfig = nginxConfig; - # TODO: ajouter les locations pour wordpress + virtualHosts."${cfg.domain}" = { + root = app.package; + index = "index.html index.htm index.php;"; + locations."/" = { + tryFiles = "$uri/index.html $uri $uri/ /index.php?$query_string;"; + }; + # fast cgi conf + locations."~ [^/]\\.php(/|$)" = { + extraConfig = '' + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:${phpFpmListen}; + fastcgi_index index.php; + ''; + }; + }; }; systemd.services.init-writeable-paths = {