nixos/nghttpx: add module for the nghttpx proxy server (#31680)
* nghttpx: Add a new NixOS module for the nghttpx proxy server This change also adds a global `uid` and `gid` for a `nghttpx` user and group as well as an integration test. * nixos/nghttpx: fix building manual
This commit is contained in:
committed by
Jörg Thalheim
parent
8bd10a17c6
commit
cb11bf73a5
@@ -0,0 +1,61 @@
|
||||
let
|
||||
nginxRoot = "/var/run/nginx";
|
||||
in
|
||||
import ./make-test.nix ({...}: {
|
||||
name = "nghttpx";
|
||||
nodes = {
|
||||
webserver = {
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
systemd.services.nginx = {
|
||||
preStart = ''
|
||||
mkdir -p ${nginxRoot}
|
||||
echo "Hello world!" > ${nginxRoot}/hello-world.txt
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."server" = {
|
||||
locations."/".root = nginxRoot;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
proxy = {
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
services.nghttpx = {
|
||||
enable = true;
|
||||
frontends = [
|
||||
{ server = {
|
||||
host = "*";
|
||||
port = 80;
|
||||
};
|
||||
|
||||
params = {
|
||||
tls = "no-tls";
|
||||
};
|
||||
}
|
||||
];
|
||||
backends = [
|
||||
{ server = {
|
||||
host = "webserver";
|
||||
port = 80;
|
||||
};
|
||||
patterns = [ "/" ];
|
||||
params.proto = "http/1.1";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
client = {};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
|
||||
$webserver->waitForOpenPort("80");
|
||||
$proxy->waitForOpenPort("80");
|
||||
$client->waitUntilSucceeds("curl -s --fail http://proxy/hello-world.txt");
|
||||
'';
|
||||
})
|
||||
Reference in New Issue
Block a user