diff options
Diffstat (limited to 'nixops/modules/websites')
-rw-r--r-- | nixops/modules/websites/default.nix | 2 | ||||
-rw-r--r-- | nixops/modules/websites/ftp/jerome.nix | 96 | ||||
-rw-r--r-- | nixops/modules/websites/ftp/jerome_goaccess.conf | 99 |
3 files changed, 197 insertions, 0 deletions
diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix index 4d5ae23..9befdd1 100644 --- a/nixops/modules/websites/default.nix +++ b/nixops/modules/websites/default.nix | |||
@@ -91,6 +91,7 @@ in | |||
91 | ./piedsjaloux | 91 | ./piedsjaloux |
92 | ./connexionswing | 92 | ./connexionswing |
93 | ./tellesflorian | 93 | ./tellesflorian |
94 | ./ftp/jerome.nix | ||
94 | ./tools/db | 95 | ./tools/db |
95 | ./tools/tools | 96 | ./tools/tools |
96 | ./tools/dav | 97 | ./tools/dav |
@@ -187,6 +188,7 @@ in | |||
187 | services.myWebsites.Aten.production.enable = cfg.production.enable; | 188 | services.myWebsites.Aten.production.enable = cfg.production.enable; |
188 | services.myWebsites.PiedsJaloux.production.enable = cfg.production.enable; | 189 | services.myWebsites.PiedsJaloux.production.enable = cfg.production.enable; |
189 | services.myWebsites.Connexionswing.production.enable = cfg.production.enable; | 190 | services.myWebsites.Connexionswing.production.enable = cfg.production.enable; |
191 | services.myWebsites.Jerome.production.enable = cfg.production.enable; | ||
190 | 192 | ||
191 | services.myWebsites.Chloe.integration.enable = cfg.integration.enable; | 193 | services.myWebsites.Chloe.integration.enable = cfg.integration.enable; |
192 | services.myWebsites.Ludivine.integration.enable = cfg.integration.enable; | 194 | services.myWebsites.Ludivine.integration.enable = cfg.integration.enable; |
diff --git a/nixops/modules/websites/ftp/jerome.nix b/nixops/modules/websites/ftp/jerome.nix new file mode 100644 index 0000000..199bfab --- /dev/null +++ b/nixops/modules/websites/ftp/jerome.nix | |||
@@ -0,0 +1,96 @@ | |||
1 | { lib, pkgs, config, myconfig, mylibs, ... }: | ||
2 | let | ||
3 | adminer = pkgs.callPackage ../commons/adminer.nix {}; | ||
4 | cfg = config.services.myWebsites.Jerome; | ||
5 | varDir = "/var/lib/ftp/jerome"; | ||
6 | env = myconfig.env.websites.jerome; | ||
7 | in { | ||
8 | options.services.myWebsites.Jerome = { | ||
9 | production = { | ||
10 | enable = lib.mkEnableOption "enable Jerome's website"; | ||
11 | }; | ||
12 | }; | ||
13 | |||
14 | imports = [ | ||
15 | ../commons/stats.nix | ||
16 | ]; | ||
17 | |||
18 | config = lib.mkIf cfg.production.enable { | ||
19 | services.myWebsites.commons.stats.enable = true; | ||
20 | services.myWebsites.commons.stats.sites = [ | ||
21 | { | ||
22 | name = "naturaloutil.immae.eu"; | ||
23 | conf = ./jerome_goaccess.conf; | ||
24 | } | ||
25 | ]; | ||
26 | |||
27 | security.acme.certs."ftp".extraDomains."naturaloutil.immae.eu" = null; | ||
28 | security.acme.certs."naturaloutil" = config.services.myCertificates.certConfig // { | ||
29 | domain = "naturaloutil.immae.eu"; | ||
30 | }; | ||
31 | |||
32 | services.myPhpfpm.poolConfigs.jerome = let | ||
33 | configFile = pkgs.writeText "naturaloutil.inc.php" '' | ||
34 | <?php | ||
35 | $mysql_user = '${env.mysql.user}' ; | ||
36 | $mysql_server = '${env.mysql.host}' ; | ||
37 | $mysql_base = '${env.mysql.name}' ; | ||
38 | $mysql_password = '${env.mysql.password}' ; | ||
39 | //connect to db | ||
40 | $db = mysqli_init(); | ||
41 | ${if env.mysql.host != "localhost" then '' | ||
42 | mysqli_options ($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true); | ||
43 | $db->ssl_set(NULL, NULL, "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt", NULL, NULL); | ||
44 | '' else ""} | ||
45 | $database = connect_db($db, $mysql_server, $mysql_base, $mysql_user, $mysql_password); | ||
46 | ?> | ||
47 | ''; | ||
48 | in '' | ||
49 | listen = /run/phpfpm/naturaloutil.sock | ||
50 | user = wwwrun | ||
51 | group = wwwrun | ||
52 | listen.owner = wwwrun | ||
53 | listen.group = wwwrun | ||
54 | |||
55 | pm = ondemand | ||
56 | pm.max_children = 5 | ||
57 | pm.process_idle_timeout = 60 | ||
58 | |||
59 | env[BDD_CONNECT] = "${configFile}" | ||
60 | php_admin_value[open_basedir] = "${configFile}:${varDir}:/tmp" | ||
61 | ''; | ||
62 | services.myPhpfpm.poolPhpConfigs.jerome = '' | ||
63 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | ||
64 | ''; | ||
65 | services.myWebsites.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ]; | ||
66 | services.myWebsites.production.vhostConfs.naturaloutil = { | ||
67 | certName = "naturaloutil"; | ||
68 | hosts = ["naturaloutil.immae.eu" ]; | ||
69 | root = varDir; | ||
70 | extraConfig = [ | ||
71 | adminer.apache.vhostConf | ||
72 | '' | ||
73 | Use Stats naturaloutil.immae.eu | ||
74 | ServerAdmin ${env.server_admin} | ||
75 | ErrorLog "${varDir}/logs/error_log" | ||
76 | CustomLog "${varDir}/logs/access_log" combined | ||
77 | |||
78 | <FilesMatch "\.php$"> | ||
79 | SetHandler "proxy:unix:/run/phpfpm/naturaloutil.sock|fcgi://localhost" | ||
80 | </FilesMatch> | ||
81 | |||
82 | <Directory ${varDir}/logs> | ||
83 | AllowOverride None | ||
84 | Require all denied | ||
85 | </Directory> | ||
86 | <Directory ${varDir}> | ||
87 | DirectoryIndex index.php index.htm index.html | ||
88 | Options Indexes FollowSymLinks MultiViews Includes | ||
89 | AllowOverride None | ||
90 | Require all granted | ||
91 | </Directory> | ||
92 | '' | ||
93 | ]; | ||
94 | }; | ||
95 | }; | ||
96 | } | ||
diff --git a/nixops/modules/websites/ftp/jerome_goaccess.conf b/nixops/modules/websites/ftp/jerome_goaccess.conf new file mode 100644 index 0000000..83c59e2 --- /dev/null +++ b/nixops/modules/websites/ftp/jerome_goaccess.conf | |||
@@ -0,0 +1,99 @@ | |||
1 | time-format %H:%M:%S | ||
2 | date-format %d/%b/%Y | ||
3 | |||
4 | #sur immae.eu | ||
5 | #log-format %v %h %^[%d:%t %^] "%r" %s %b "%R" "%u" $^ | ||
6 | |||
7 | log-format VCOMBINED | ||
8 | #= %v:%^ %h %^[%d:%t %^] "%r" %s %b "%R" "%u" | ||
9 | |||
10 | html-prefs {"theme":"bright","layout":"vertical"} | ||
11 | |||
12 | exclude-ip 188.165.209.148 | ||
13 | exclude-ip 178.33.252.96 | ||
14 | exclude-ip 2001:41d0:2:9c94::1 | ||
15 | exclude-ip 2001:41d0:2:9c94:: | ||
16 | exclude-ip 176.9.151.89 | ||
17 | exclude-ip 2a01:4f8:160:3445:: | ||
18 | exclude-ip 82.255.56.72 | ||
19 | |||
20 | no-query-string true | ||
21 | |||
22 | keep-db-files true | ||
23 | load-from-disk true | ||
24 | db-path /var/lib/goaccess/naturaloutil.immae.eu | ||
25 | |||
26 | ignore-panel REFERRERS | ||
27 | ignore-panel KEYPHRASES | ||
28 | |||
29 | static-file .css | ||
30 | static-file .js | ||
31 | static-file .jpg | ||
32 | static-file .png | ||
33 | static-file .gif | ||
34 | static-file .ico | ||
35 | static-file .jpeg | ||
36 | static-file .pdf | ||
37 | static-file .csv | ||
38 | static-file .mpeg | ||
39 | static-file .mpg | ||
40 | static-file .swf | ||
41 | static-file .woff | ||
42 | static-file .woff2 | ||
43 | static-file .xls | ||
44 | static-file .xlsx | ||
45 | static-file .doc | ||
46 | static-file .docx | ||
47 | static-file .ppt | ||
48 | static-file .pptx | ||
49 | static-file .txt | ||
50 | static-file .zip | ||
51 | static-file .ogg | ||
52 | static-file .mp3 | ||
53 | static-file .mp4 | ||
54 | static-file .exe | ||
55 | static-file .iso | ||
56 | static-file .gz | ||
57 | static-file .rar | ||
58 | static-file .svg | ||
59 | static-file .bmp | ||
60 | static-file .tar | ||
61 | static-file .tgz | ||
62 | static-file .tiff | ||
63 | static-file .tif | ||
64 | static-file .ttf | ||
65 | static-file .flv | ||
66 | #static-file .less | ||
67 | #static-file .ac3 | ||
68 | #static-file .avi | ||
69 | #static-file .bz2 | ||
70 | #static-file .class | ||
71 | #static-file .cue | ||
72 | #static-file .dae | ||
73 | #static-file .dat | ||
74 | #static-file .dts | ||
75 | #static-file .ejs | ||
76 | #static-file .eot | ||
77 | #static-file .eps | ||
78 | #static-file .img | ||
79 | #static-file .jar | ||
80 | #static-file .map | ||
81 | #static-file .mid | ||
82 | #static-file .midi | ||
83 | #static-file .ogv | ||
84 | #static-file .webm | ||
85 | #static-file .mkv | ||
86 | #static-file .odp | ||
87 | #static-file .ods | ||
88 | #static-file .odt | ||
89 | #static-file .otf | ||
90 | #static-file .pict | ||
91 | #static-file .pls | ||
92 | #static-file .ps | ||
93 | #static-file .qt | ||
94 | #static-file .rm | ||
95 | #static-file .svgz | ||
96 | #static-file .wav | ||
97 | #static-file .webp | ||
98 | |||
99 | |||