blob: 9576a9ec0fe8b8547e8da204edab0228ea683eec (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
{ lib, pkgs, config, ... }:
let
cfg = config.myServices.websites.papa.maison_bbc;
varDir = "/var/lib/ftp/papa/site";
in {
options.myServices.websites.papa.maison_bbc.enable = lib.mkEnableOption "enable Papa Maison bbc website";
config = lib.mkIf cfg.enable {
services.duplyBackup.profiles.papa_maison_bbc.rootDir = varDir;
services.webstats.sites = [ { name = "maison.bbc.bouya.org"; } ];
services.phpfpm.pools.papa_maison_bbc = {
user = "wwwrun";
group = "wwwrun";
settings = {
"listen.owner" = "wwwrun";
"listen.group" = "wwwrun";
"pm" = "ondemand";
"pm.max_children" = "5";
"pm.process_idle_timeout" = "60";
"php_admin_value[open_basedir]" = varDir;
};
phpOptions = config.services.phpfpm.phpOptions + ''
date.timezone = 'Europe/Paris'
extension=${pkgs.php}/lib/php/extensions/mysqli.so
'';
};
services.websites.env.production.modules = [ "proxy_fcgi" ];
services.websites.env.production.vhostNoSSLConfs.papa_maison_bbc = {
hosts = [ "maison.bbc.bouya.org" ];
root = varDir;
extraConfig = [
''
Alias /.well-known/acme-challenge ${config.security.acme.certs.papa.webroot}/.well-known/acme-challenge
RedirectMatch 301 ^/((?!(\.well-known|add.php).*$).*)$ https://maison.bbc.bouya.org/$1
<Directory ${varDir}>
DirectoryIndex index.php index.htm index.html
AllowOverride None
Require all granted
<FilesMatch "\.php$">
SetHandler "proxy:unix:${config.services.phpfpm.pools.papa_maison_bbc.socket}|fcgi://localhost"
</FilesMatch>
</Directory>
<Directory "${config.security.acme.certs.papa.webroot}">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
''
];
};
services.websites.env.production.vhostConfs.papa_maison_bbc = {
certName = "papa";
addToCerts = true;
hosts = [ "maison.bbc.bouya.org" ];
root = varDir;
forceSSL = false;
extraConfig = [
''
<Directory ${varDir}>
DirectoryIndex index.php index.htm index.html
AllowOverride None
Require all granted
<FilesMatch "\.php$">
SetHandler "proxy:unix:${config.services.phpfpm.pools.papa_maison_bbc.socket}|fcgi://localhost"
</FilesMatch>
</Directory>
''
];
};
};
}
|