Welcome! Log In Create A New Profile

Advanced

Re: multiple blocks or single reg exp

Maxim Dounin
July 31, 2011 09:42AM
Hello!

On Sun, Jul 31, 2011 at 09:27:41AM -0400, token wrote:

> Hello,
> which would be the best way to handle this multiple location blocks or a
> single location block with a regular exp.
>
> location /css/ { root /var/www/static_includes/; expires 97d; }
> location /images/ { root /var/www/static_includes/; expires 97d; }
> location /js/ { root /var/www/static_includes/; expires 97d;}
>
> ----------------
>
> location ~ /(css|images|js)/ {
> root /var/www/static_includes/;
> expires 97d;
> }

Use multiple normal location blocks.

Regexp locations do introduce unneeded complexity and make
configuration maintenance much harder. Besides that, (a) it's
easy to make regexp incorrectly (e.g. you missed "^") and (b)
normal locations are faster (though you wouldn't likely notice).

Maxim Dounin

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

multiple blocks or single reg exp

token July 31, 2011 09:27AM

Re: multiple blocks or single reg exp

Maxim Dounin July 31, 2011 09:42AM

Re: multiple blocks or single reg exp

token July 31, 2011 09:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 262
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