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