add mkNginxServer
This commit is contained in:
parent
b277d43f77
commit
69d374a24f
|
@ -23,6 +23,8 @@
|
|||
|
||||
# add to top level because it has a binary
|
||||
feedvalidator = final.python312Packages.feedvalidator;
|
||||
|
||||
mkNginxServer = prev.callPackage ./lib/dev-nginx {};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
writeText,
|
||||
writeShellScriptBin,
|
||||
|
||||
nginx,
|
||||
systemd
|
||||
}:
|
||||
|
||||
{ siteConfig }:
|
||||
let conf = writeText "nginx.conf" ''
|
||||
daemon off;
|
||||
events {}
|
||||
pid /tmp/nginx.pid;
|
||||
http {
|
||||
access_log /dev/stdout;
|
||||
|
||||
client_body_temp_path /tmp;
|
||||
proxy_temp_path /tmp;
|
||||
fastcgi_temp_path /tmp;
|
||||
uwsgi_temp_path /tmp;
|
||||
scgi_temp_path /tmp;
|
||||
|
||||
include ${nginx}/conf/mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
|
||||
types_hash_max_size 4096;
|
||||
types_hash_bucket_size 128;
|
||||
|
||||
server {
|
||||
server_name localhost;
|
||||
listen 127.0.0.1:8080;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain application/xml image/svg+xml text/css text/javascript;
|
||||
|
||||
${siteConfig}
|
||||
}
|
||||
}
|
||||
'';
|
||||
in
|
||||
writeShellScriptBin "dev-nginx.sh" ''
|
||||
exec ${systemd}/bin/systemd-run --user -t -pPrivateTmp=true --working-directory="$PWD" ${nginx}/bin/nginx -p "$PWD" -e stderr -c ${conf}
|
||||
''
|
Loading…
Reference in New Issue