at 23.11-pre 737 B view raw
1import ./make-test-python.nix { 2 name = "nginx-pubhtml"; 3 4 nodes.machine = { pkgs, ... }: { 5 systemd.services.nginx.serviceConfig.ProtectHome = "read-only"; 6 services.nginx.enable = true; 7 services.nginx.virtualHosts.localhost = { 8 locations."~ ^/\\~([a-z0-9_]+)(/.*)?$".alias = "/home/$1/public_html$2"; 9 }; 10 users.users.foo.isNormalUser = true; 11 }; 12 13 testScript = '' 14 machine.wait_for_unit("nginx") 15 machine.wait_for_open_port(80) 16 machine.succeed("chmod 0711 /home/foo") 17 machine.succeed("su -c 'mkdir -p /home/foo/public_html' foo") 18 machine.succeed("su -c 'echo bar > /home/foo/public_html/bar.txt' foo") 19 machine.succeed('test "$(curl -fvvv http://localhost/~foo/bar.txt)" = bar') 20 ''; 21}