dennis the formatter (#75)
* dennis the formatter * changed comment * fixup
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
eachSite = config.services.staticpage.sites;
|
||||
|
||||
siteOpts = { lib, name, config, ... }: {
|
||||
options = {
|
||||
package = lib.mkPackageOption pkgs "page" { };
|
||||
@ -41,7 +40,6 @@ in
|
||||
{
|
||||
options.services.staticpage = {
|
||||
enable = lib.mkEnableOption "staticpage";
|
||||
|
||||
sites = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule siteOpts);
|
||||
default = { };
|
||||
@ -57,7 +55,6 @@ in
|
||||
name = "${(if (cfg.subdomain == null) then "${cfg.domain}" else "${cfg.subdomain}.${cfg.domain}")}";
|
||||
value = {
|
||||
root = "/var/lib/www/${cfg.root}";
|
||||
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
serverAliases = lib.mkIf (cfg.subdomain == null) [ "www.${cfg.domain}" ];
|
||||
@ -68,6 +65,7 @@ in
|
||||
access_log off;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."= /robots.txt" = {
|
||||
extraConfig = ''
|
||||
allow all;
|
||||
@ -75,11 +73,13 @@ in
|
||||
access_log off;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~* ^/.well-known/" = {
|
||||
extraConfig = ''
|
||||
allow all;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~* .(js|css|png|jpg|jpeg|gif|ico|svg)$" = {
|
||||
extraConfig = ''
|
||||
try_files $uri @rewrite;
|
||||
@ -87,6 +87,7 @@ in
|
||||
log_not_found off;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ ^/sites/.*/files/styles/" = {
|
||||
extraConfig = ''
|
||||
try_files $uri @rewrite;
|
||||
@ -118,37 +119,44 @@ in
|
||||
return 403;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ ^/sites/.*/private/" = {
|
||||
extraConfig = ''
|
||||
return 403;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ ^/sites/[^/]+/files/.*.php$" = {
|
||||
extraConfig = ''
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
try_files $uri /index.php?$query_string;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."@rewrite" = {
|
||||
extraConfig = ''
|
||||
rewrite ^ /index.php;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ /vendor/.*.php$" = {
|
||||
extraConfig = ''
|
||||
deny all;
|
||||
return 404;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ ^/sites/.*/files/styles/" = {
|
||||
extraConfig = ''
|
||||
try_files $uri @rewrite;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ ^(/[a-z-]+)?/system/files/" = {
|
||||
extraConfig = ''
|
||||
try_files $uri /index.php?$query_string;
|
||||
@ -171,6 +179,7 @@ in
|
||||
(lib.mapAttrs
|
||||
(name: cfg: {
|
||||
user = "nginx";
|
||||
phpEnv."PATH" = lib.makeBinPath [ pkgs.php ];
|
||||
settings = {
|
||||
"listen.owner" = config.services.nginx.user;
|
||||
"pm" = "dynamic";
|
||||
@ -183,7 +192,6 @@ in
|
||||
"php_admin_flag[log_errors]" = true;
|
||||
"catch_workers_output" = true;
|
||||
};
|
||||
phpEnv."PATH" = lib.makeBinPath [ pkgs.php ];
|
||||
})
|
||||
(lib.filterAttrs (n: v: v.usePHP) eachSite))
|
||||
];
|
||||
|
Reference in New Issue
Block a user