1 import ./make-test-python.nix {
2 name = "nginx-pubhtml";
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";
10 users.users.foo.isNormalUser = true;
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')