try_files issue

Xavier Grangier grangier at
Sat Feb 14 01:38:02 MSK 2009

> - 	try_files $document_root/$uroot @django;
> + 	try_files /$uroot @django;

works well thanks for your answer.
finally the probleme is on the dynamic build of $croot for exemple :

location /users/ {
	#set $croot cache/1/1/1/fr.html;
	## match /users/1/fr/xxxx/
	if ($request_uri ~ /([0-9])/(\w+)/[-\w]+/$) {
		set $croot cache/$1/$1/$1/$2.html;
		set $deb 2;
	sub_filter nginx '$croot - $uri - $deb';
	try_files $croot @django;

returns a 403 forbidden. wether the cache file exists or not.
With sub filter I can see that : nginx is well replace by 'cache/1/1/1/ 
fr.html - /users/1/fr/xxxx/ - 2' so all variables are set.

if I do set $croot like this (same value as before)

location /users/ {
	set $croot cache/1/1/1/fr.html;
	try_files $croot @django;

it works as expected. cache is served if exists or backend is called.

Where do I mixed up ?



More information about the nginx mailing list