Welcome! Log In Create A New Profile

Advanced

Re: How do I exclude one folder from a try_files?

B.R. via nginx
June 25, 2017 04:38AM
You do not seem to be understanding what you are doing.

First, all path start with '/', thus your 'location ~* wiki/images/'
directive will never match anything.

Second, why are you using regex locations? Prefix ones are most efficient
as you do not need any special processing inside the location mask.
'location /wiki/images/' would do.
'location /' is also enough as the most generic ('catch-all') prefix
location, matching all requests by default, having the lowest precedence.

​I suggest you give another look at the location
<https://nginx.org/en/docs/http/ngx_http_core_module.html#location>
directive docs.​
---
*B. R.*

On Sun, Jun 25, 2017 at 12:08 AM, Joergi <nginx-forum@forum.nginx.org>
wrote:

> Hi guys,
>
> I am having a configuration, which is basically rewriting all requests, for
> which a fitting file cannot be found, to a central index.php file:
>
> location ~* "^/" {
> root /home/$username/www/;
> try_files $uri $uri/ /wiki/index.php$is_args$args;
>
> location ~ \.php$ {
> try_files $uri $uri/ /wiki/index.php$is_args$args;
> include /etc/nginx/fastcgi_params;
> fastcgi_pass unix:/var/run/php5-fpm-$username.sock;
> }
> }
>
> Now, for one folder, wiki/images/, nothing should be rewritten at all.
> nginx
> should just try existing files, and if no file with the requested name is
> there, I want to get the nginx 404 error page.
>
> I tried with
>
> location ~* wiki/images/ {
> # Nothing here
> }
>
> but nginx is still changing the URL.
>
> Can someone tell me, how I can make nginx just deliver existing files from
> folder wiki/images/?
>
> Cheers
>
> Jörg
>
> Posted at Nginx Forum: https://forum.nginx.org/read.
> php?2,275123,275123#msg-275123
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

How do I exclude one folder from a try_files?

Joergi June 24, 2017 06:08PM

Re: How do I exclude one folder from a try_files?

B.R. via nginx June 25, 2017 04:38AM

Re: How do I exclude one folder from a try_files?

Joergi June 25, 2017 07:50AM

Re: How do I exclude one folder from a try_files?

Francis Daly June 25, 2017 02:04PM

Re: How do I exclude one folder from a try_files?

Joergi June 25, 2017 04:36PM

Re: How do I exclude one folder from a try_files?

Francis Daly June 26, 2017 12:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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