diff options
author | Parnell Springmeyer <ixmatus@users.noreply.github.com> | 2017-11-16 12:21:02 -0600 |
---|---|---|
committer | Jörg Thalheim <Mic92@users.noreply.github.com> | 2017-11-16 18:21:02 +0000 |
commit | cb11bf73a511819ee36c4bddb97573aacda0b161 (patch) | |
tree | f4256571834c529fb6fa204f3163a7b965302574 /nixos/tests | |
parent | 8bd10a17c6c811b423126af1d3dc37aa82a7c131 (diff) | |
download | nixlib-cb11bf73a511819ee36c4bddb97573aacda0b161.tar nixlib-cb11bf73a511819ee36c4bddb97573aacda0b161.tar.gz nixlib-cb11bf73a511819ee36c4bddb97573aacda0b161.tar.bz2 nixlib-cb11bf73a511819ee36c4bddb97573aacda0b161.tar.lz nixlib-cb11bf73a511819ee36c4bddb97573aacda0b161.tar.xz nixlib-cb11bf73a511819ee36c4bddb97573aacda0b161.tar.zst nixlib-cb11bf73a511819ee36c4bddb97573aacda0b161.zip |
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
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/nghttpx.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/nixos/tests/nghttpx.nix b/nixos/tests/nghttpx.nix new file mode 100644 index 000000000000..433562b97191 --- /dev/null +++ b/nixos/tests/nghttpx.nix @@ -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"); + ''; + }) |