mirror of
https://github.com/oqyude/nixos.git
synced 2026-06-15 22:41:52 +03:00
123
This commit is contained in:
@@ -9,6 +9,7 @@ in
|
|||||||
{
|
{
|
||||||
environment.etc."nginx/.htpasswd".text = ''
|
environment.etc."nginx/.htpasswd".text = ''
|
||||||
test:$apr1$3m7iYgVv$31i.S8LP3i8dKuOIBhoeE1
|
test:$apr1$3m7iYgVv$31i.S8LP3i8dKuOIBhoeE1
|
||||||
|
oqyude:$apr1$SOZTZPw9$33dfsailwRjmgbpeohYtQ.
|
||||||
'';
|
'';
|
||||||
users.users.nginx.extraGroups = [ "acme" ];
|
users.users.nginx.extraGroups = [ "acme" ];
|
||||||
services = {
|
services = {
|
||||||
@@ -27,7 +28,18 @@ in
|
|||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
auth_basic "Restricted";
|
auth_basic "Restricted";
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||||
|
|
||||||
autoindex off;
|
autoindex off;
|
||||||
|
|
||||||
|
# выдаём файл в зависимости от пользователя
|
||||||
|
satisfy all;
|
||||||
|
|
||||||
|
if ($remote_user = "test") {
|
||||||
|
rewrite ^/empty.txt$ /test.txt break;
|
||||||
|
}
|
||||||
|
if ($remote_user = "oqyude") {
|
||||||
|
rewrite ^/empty.txt$ /my.txt break;
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user