Welcome! Log In Create A New Profile

Advanced

Re: помощь в location

October 30, 2012 01:12PM
On Tuesday 30 October 2012 17:51:37 selts wrote:
> Добрый день!
> Скажите пож у меня есть такой location
>
> location ~* \.(txt|log|rar)$ {
> access_log on;

Писать access_log в файл с именем "on" - это очень странно.

> rewrite ^ http://mysite/error? permanent;

return 301 http://mysite/error;

Но запрещать доступ путем 301 редиректа - очень странно.

> }
>
> он закрывает все файлы с перечисленными расширениями на всем сайте а сейчас
> мне надо сделать так чтоб файлы с расширениями txt были доступны но только
> из корня сайта а на всем остальном сайте доступ по прежнему был закрыт?
> подскажите как написать правильный location?
>

location ~* ^/[^\]+\.txt$ {
# доступ открыт
}

location ~* \.(?:txt|log|rar)$ {
# доступ закрыт
}

--
Валентин Бартенев
http://nginx.com/support.html
http://nginx.org/en/donation.html
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

помощь в location

selts October 30, 2012 09:51AM

Re: помощь в location

Daniel Podolsky October 30, 2012 10:24AM

Re: помощь в location

selts October 30, 2012 10:56AM

Re: помощь в location

Daniel Podolsky October 30, 2012 12:58PM

Re: помощь в location

Andrey Repin October 30, 2012 01:02PM

Re: помощь в location

VBart October 30, 2012 01:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready