module(wp): add domain and nginx basic location

This commit is contained in:
Raito Bezarius 2021-11-22 23:05:16 +01:00
parent 6a31dcee0b
commit 1402072fd0

View file

@ -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 = {