Performance question regarding regex
panni
nginx-forum at nginx.us
Fri Jul 30 17:42:33 MSD 2010
Thank you again for your quick answer.
Igor Sysoev Wrote:
-------------------------------------------------------
> On Thu, Jul 29, 2010 at 07:44:54PM -0400, panni
> wrote:
>
> > Hey, thank you for your answer.
> >
> > try_files only seems to hit when a root
> directive is set in the config.
> > try_files only works on /home/www$uri files, not
> on /www/html$uri
> > files.
> > Is this intended? How can I make it work when a
> file called
> > /www/html/asdf.php is requested by /asdf.php?
>
> root /;
> try_files home/www$uri www/html$uri
> @ksphp;
>
> but probably it's better to use:
>
> location = /asdf.php {
> fastcgi_pass ...
> fastcgi_param SCRIPT_FILENAME
> /www/html$uri;
> ....
> }
Is try_files over three possible locations that slow or why are you
suggesting the directive for the literal string?
>
> > location / {
> > root /home/www;
> > try_files $uri "/www/html$uri"
> @ksphp;
> >
> > if ($request_filename ~*
> \.(js|css)$) {
> > return 404;
> > }
> >
> > index index.php;
> > expires 30d;
> > }
>
> Do not use "if ($request_filename":
>
> location / {
> root /home/www;
> try_files $uri @ksphp;
>
> index index.php;
> expires 30d;
> }
>
> location ~* \.(js|css)$ {
> return 404;
> }
Thank you. But why would you do this rather than an if clause? If its
faster, or my way a no-go, do you have some sort of compendium of do's
and don'ts in NGINX?
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,109438,114822#msg-114822
More information about the nginx
mailing list