Maxim Dounin wrote: > Use map instead: Thanks, map works nicely :) > avoid using such "timestamped log names" at all as this approach implies unneeded overhead on opening/closing files for each request. I use open_log_file_cache to mitigate this. Are there still problems with that? I would prefer to keep things simple and avoid explicit log rotation. The latter requirby igorb - Nginx Mailing List - English
I use the if trick to get timestamped log names: if ($time_iso8601 ~ "^(\d{4})-(\d{2})") { set $year $1; set $month $2; } access_log .../access-$year-$month.log combined; However, with nginx/1.4.6 (Ubuntu) I see that for invalid HTTP requests $year and $month are not set. For example, with the above config after issuing from a shell: ~> printf foo | nc host 80 I seby igorb - Nginx Mailing List - English
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 =404; } } } For localhost/x/test.html $1 will be test.html. I suppose $docuby igorb - Nginx Mailing List - English
That does not work either. What works is try_files "" =404 together with an explicit alias as Francis Daly described in another post.by igorb - Nginx Mailing List - English
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 { try_files "" =404; } } } does not work, while the follby igorb - Nginx Mailing List - English
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/; } location ~ ^/x/(test.*)$ { alias /test/$1; try_files /test/$1by igorb - Nginx Mailing List - English
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; try_files $uri =404; } } However that still gives 404 for localhost/by igorb - Nginx Mailing List - English
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/ { alias /test/; location ~ ^/x/test { try_filesby igorb - Nginx Mailing List - English