Re: try_files and a nested location regexp

2014-10-16 Thread Francis Daly
On Thu, Oct 16, 2014 at 08:42:26AM -0400, igorb wrote: Hi there, > Thanks again for detailed explanation. Now I almost grasped how try_files > works. "Almost" because I still do not see why the following does not work: There is a defect which is involved here, and probably interferes: http://tr

Re: try_files and a nested location regexp

2014-10-16 Thread igorb
Thanks again for detailed explanation. Now I almost grasped how try_files works. "Almost" because I still do not see why the following does not work: server { listen 8080 default_server; root /usr/share/nginx/html; autoindex on; location /x/ { alias /test/; location ~ ^/x/(test.*) { try_files $1

Re: try_files and a nested location regexp

2014-10-16 Thread Edho Arief
On Thu, Oct 16, 2014 at 9:03 PM, igorb wrote: > That does not work either. What works is try_files "" =404 together with an > explicit alias as Francis Daly described in another post. > did you put it inside the aliased location block? That'd explain why it doesn't work (as francis said, $documen

Re: try_files and a nested location regexp

2014-10-16 Thread Francis Daly
On Thu, Oct 16, 2014 at 07:55:48AM -0400, igorb wrote: Hi there, > Thanks, try_files "" =404 works indeed as long as the regexp location block > contains the necessary alias. That sounds correct. "alias" sets $document_root. try_files concatenates $document_root with its "file" argument. (It do

Re: try_files and a nested location regexp

2014-10-16 Thread igorb
That does not work either. What works is try_files "" =404 together with an explicit alias as Francis Daly described in another post. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,254033,254043#msg-254043 ___ nginx mailing list nginx@nginx.o

Re: try_files and a nested location regexp

2014-10-16 Thread igorb
Thanks, try_files "" =404 works indeed as long as the regexp location block contains the necessary alias. I.e. the original example modified like in: server { listen 8080 default_server; root /usr/share/nginx/html; autoindex on; location /x/ { alias /test/; location ~ ^/x/test {

Re: try_files and a nested location regexp

2014-10-16 Thread Edho Arief
On Thu, Oct 16, 2014 at 8:25 PM, igorb wrote: > I tried that, but it still does not work. The following config as before > still gives 404 for localhost/x/test.html : > > server { > listen 8080 default_server; > root /usr/share/nginx/html; > autoindex on; > > locati

Re: try_files and a nested location regexp

2014-10-16 Thread Francis Daly
On Thu, Oct 16, 2014 at 07:09:44AM -0400, igorb wrote: Hi there, > location ~ ^/x/(test.*)$ { > alias /test/$1; > try_files $uri =404; > } > However that still gives 404 for localhost/x/test.html . Does that mean that > try_files cannot be used at

Re: try_files and a nested location regexp

2014-10-16 Thread igorb
I tried that, but it still does not work. The following config as before still gives 404 for localhost/x/test.html : server { listen 8080 default_server; root /usr/share/nginx/html; autoindex on; location /x/ { alias /test/; } locat

Re: try_files and a nested location regexp

2014-10-16 Thread Edho Arief
On Thu, Oct 16, 2014 at 8:09 PM, igorb wrote: > I tried to add explicit alias to the regexp location: > > server { > listen 8080 default_server; > root /usr/share/nginx/html; > autoindex on; > > location /x/ { > alias /test/; > } > >

Re: try_files and a nested location regexp

2014-10-16 Thread igorb
I tried to add explicit alias to the regexp location: server { listen 8080 default_server; root /usr/share/nginx/html; autoindex on; location /x/ { alias /test/; } location ~ ^/x/(test.*)$ { alias /test/$1;

Re: try_files and a nested location regexp

2014-10-16 Thread Sergey Kandaurov
On Oct 16, 2014, at 1:38 PM, igorb wrote: > [...] > So what is wrong with the usage of try_files in the initial regexp-based > location config? That is because a location defined with a regular expression has no fixed length to make a replacement in try_files, which is what alias do. -- Sergey

try_files and a nested location regexp

2014-10-16 Thread igorb
I could not figure out why try_files in a nested location defined with a regexp does not work in nginx/1.4.6 under Ubuntu 14.04. Consider the following config: server { listen 8080 default_server; root /usr/share/nginx/html; autoindex on; location /x/ {