1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 13:41:26 +00:00
nixpkgs/nixos/tests/nghttpx.nix

62 lines
1.3 KiB
Nix
Raw Normal View History

let
2018-12-19 21:55:00 +00:00
nginxRoot = "/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;
2019-08-13 22:52:01 +01:00
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");
'';
})