]>
Commit | Line | Data |
---|---|---|
1 | { stdenv, fetchurl, nginx }: | |
2 | let | |
3 | adminer = rec { | |
4 | webRoot = stdenv.mkDerivation rec { | |
5 | version = "4.7.0"; | |
6 | name = "adminer-${version}"; | |
7 | src = fetchurl { | |
8 | url = "https://www.adminer.org/static/download/${version}/${name}.php"; | |
9 | sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7"; | |
10 | }; | |
11 | phases = "installPhase"; | |
12 | installPhase = '' | |
13 | mkdir -p $out | |
14 | cp $src $out/index.php | |
15 | ''; | |
16 | }; | |
17 | phpFpm = rec { | |
18 | socket = "/var/run/phpfpm/adminer.sock"; | |
19 | pool = '' | |
20 | listen = ${socket} | |
21 | user = ${apache.user} | |
22 | group = ${apache.group} | |
23 | listen.owner = ${apache.user} | |
24 | listen.group = ${apache.group} | |
25 | pm = ondemand | |
26 | pm.max_children = 5 | |
27 | pm.process_idle_timeout = 60 | |
28 | ;php_admin_flag[log_errors] = on | |
29 | ; Needed to avoid clashes in browser cookies (same domain) | |
30 | php_value[session.name] = AdminerPHPSESSID | |
31 | php_admin_value[open_basedir] = "${webRoot}:/tmp" | |
32 | php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer" | |
33 | ''; | |
34 | }; | |
35 | apache = { | |
36 | user = "wwwrun"; | |
37 | group = "wwwrun"; | |
38 | modules = [ "proxy_fcgi" ]; | |
39 | vhostConf = '' | |
40 | Alias /adminer ${webRoot} | |
41 | <Directory ${webRoot}> | |
42 | DirectoryIndex index.php | |
43 | Require all granted | |
44 | <FilesMatch "\.php$"> | |
45 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | |
46 | </FilesMatch> | |
47 | </Directory> | |
48 | ''; | |
49 | }; | |
50 | nginxConf = { | |
51 | alias = webRoot; | |
52 | index = "index.php"; | |
53 | extraConfig = '' | |
54 | include ${nginx}/conf/fastcgi.conf; | |
55 | fastcgi_split_path_info ^(.+?\.php)(/.*)$; | |
56 | fastcgi_param HTTP_PROXY ""; | |
57 | fastcgi_param SCRIPT_FILENAME ${webRoot}/index.php; | |
58 | fastcgi_pass unix:${phpFpm.socket}; | |
59 | fastcgi_index index.php; | |
60 | fastcgi_intercept_errors on; | |
61 | ''; | |
62 | }; | |
63 | }; | |
64 | in | |
65 | adminer |