Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: auth basic и неавторизованные пользователи
Нашел решение проблемы примерно так:
location ~ /bin/view/(System|System/.*|Main|Main/.*|Sandbox|Sandbox/.*) {
error_page 404 502 504 = @foswiki_auth;
}
location ~
/bin/(attach|edit|manage|rename|save|upload|mail|logon|rest|rdiff|.*auth).*
{
error_page 404 502 504 = @foswiki_auth;
}
location ~ /bin/.* {
if ($http_cookie ~* "adminid=yes"){
set $auth "_auth";
}
error_page 404 502 504 = @foswiki$auth;
}
location ~
(^/pub/Trash|^/lib|^/data|^/locale|^/templates|^/tools|^/work) { deny
all; }
location @foswiki_auth {
gzip off;
fastcgi_pass unix:/var/run/wiki/fcgi.sock;
fastcgi_split_path_info ^(/bin/\w+)(.*);
fastcgi_param SCRIPT_FILENAME
/opt/data/wiki$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
include fastcgi_params;
auth_basic "Enter your WikiName. (First name and
last name, no space, no dots, capitalized, e.g. JohnSmith). Cancel to
register if you do not have one.";
auth_basic_user_file /opt/data/wiki/data/.htpasswd;
add_header Set-Cookie "adminid=yes;path=/";
}
location @foswiki {
gzip off;
fastcgi_pass unix:/var/run/wiki/fcgi.sock;
fastcgi_split_path_info ^(/bin/\w+)(.*);
fastcgi_param SCRIPT_FILENAME
/opt/data/wiki$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
include fastcgi_params;
}
Лучшего варианта пока не придумывается. Может кто-то подскажет более
элегантный вариант?
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru
|