blob: 05b0e88f3e89b2aa3b2f76ed42671b513cce3d51 (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
with import ../libs.nix;
with nixpkgs_unstable;
let
adminer = rec {
webRoot = pkgs.stdenv.mkDerivation rec {
version = "4.7.0";
name = "adminer-${version}";
src = pkgs.fetchurl {
url = "https://www.adminer.org/static/download/${version}/${name}.php";
sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7";
};
phases = "installPhase";
installPhase = ''
mkdir -p $out
cp $src $out/index.php
'';
};
phpFpm = rec {
socket = "/var/run/phpfpm/adminer.sock";
pool = ''
listen = ${socket}
user = ${apache.user}
group = ${apache.group}
listen.owner = ${apache.user}
listen.group = ${apache.group}
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 60
;php_admin_flag[log_errors] = on
php_admin_value[open_basedir] = "${webRoot}:/tmp"
'';
};
apache = {
user = "wwwrun";
group = "wwwrun";
modules = [ "proxy_fcgi" ];
vhostConf = ''
Alias /adminer ${webRoot}
<Directory ${webRoot}>
DirectoryIndex = index.php
<FilesMatch "\.php$">
SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
</FilesMatch>
</Directory>
'';
};
nginxConf = {
alias = webRoot;
index = "index.php";
extraConfig = ''
include ${pkgs.nginx}/conf/fastcgi.conf;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME ${webRoot}/index.php;
fastcgi_pass unix:${phpFpm.socket};
fastcgi_index index.php;
fastcgi_intercept_errors on;
'';
};
};
ympd = rec {
config = {
webPort = "localhost:18001";
mpd = {
host = "malige.home.immae.eu";
port = 6600;
};
};
apache = {
vhostConf = ''
<LocationMatch "^/mpd">
Use LDAPConnect
Require ldap-group cn=users,cn=mpd,ou=services,dc=immae,dc=eu
Require local
</LocationMatch>
RedirectMatch permanent "^/mpd$" "/mpd/"
<Location "/mpd/">
ProxyPass http://${config.webPort}/
ProxyPassReverse http://${config.webPort}/
ProxyPreserveHost on
</Location>
<Location "/mpd/ws">
ProxyPass ws://${config.webPort}/ws
</Location>
'';
};
};
in
{
inherit adminer;
inherit ympd;
}
|