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