This commit is contained in:
2026-01-04 19:53:13 +03:00
parent 71c4243849
commit b03caa374f
+12
View File
@@ -9,6 +9,7 @@ in
{
environment.etc."nginx/.htpasswd".text = ''
test:$apr1$3m7iYgVv$31i.S8LP3i8dKuOIBhoeE1
oqyude:$apr1$SOZTZPw9$33dfsailwRjmgbpeohYtQ.
'';
users.users.nginx.extraGroups = [ "acme" ];
services = {
@@ -27,7 +28,18 @@ in
extraConfig = ''
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
autoindex off;
# выдаём файл в зависимости от пользователя
satisfy all;
if ($remote_user = "test") {
rewrite ^/empty.txt$ /test.txt break;
}
if ($remote_user = "oqyude") {
rewrite ^/empty.txt$ /my.txt break;
}
'';
};
};