Welcome! Log In Create A New Profile

Advanced

Re: case insensitive

July 29, 2010 04:10AM
On Thu, Jul 29, 2010 at 11:45:23AM +0400, Boris Dolgov wrote:

> On Thu, Jul 29, 2010 at 10:47 AM, Igor Sysoev <igor@sysoev.ru> wrote:
> > On Wed, Jul 28, 2010 at 11:26:24PM -0700, Eire Angel wrote:
> >> I need to serve images to be case insensitive.
> >> too many of the external links were created using the incorrect case for me to
> >> just create redirects for them all
> >> I am trying to use :
> >> location ~* ^.+.(jpg|jpeg|gif|png)$ {
> >>  root              /var/www/my_app/current/public/images;
> >> access_log        off;
> >> expires           30d;
> >> }
> >>
> >> i have also tried using :
> >> location ~* ^/images/$ {}
> >> with the same results.  please help
> >
> > nginx does not support case insensitive file access on a case sensitive file
> > system. Theoretically this can be implemented, however, it requires
> > a lot of overhead: instead of single open() syscall, nginx has to call
> > opendir()/readir()/closedir() which involve about ten syscalls. Although
> > frequently requested files can be cached in open_file_cache.
> You can also try renaming all your images to lowercase and then use
> something like this:
> location ~* (?P<name>.*)\.(?P<ext>jpg|jpeg|gif|png)$
> {
> perl_set new_name 'sub { my $r = shift; return lc($r->variable("name"); }'
> perl_set new_ext 'sub { my $r = shift; return lc($r->variable("ext"); }'
> try_files $new_name.$new_ext /404error;
> }

A note: perl_set can be defined on http level only.
It can be simpler:

http {
perl_set $lc_uri 'sub { my $r = shift; return lc($r->uri); }'

server {
location / {
try_files $lc_uri =404;
}


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

case insensitive

Eire Angel July 29, 2010 02:38AM

Re: case insensitive

Igor Sysoev July 29, 2010 02:54AM

Re: case insensitive

Boris Dolgov July 29, 2010 03:58AM

Re: case insensitive

Igor Sysoev July 29, 2010 04:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 234
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready