How do I exclude one folder from a try_files?

Joergi nginx-forum at forum.nginx.org
Sat Jun 24 22:08:37 UTC 2017


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



More information about the nginx mailing list