Welcome! Log In Create A New Profile

Advanced

Re: Strange try_files behaviour

July 14, 2014 12:44PM
Maxim Dounin Wrote:
-------------------------------------------------------
> And we even have a trac ticket for this:
>
> http://trac.nginx.org/nginx/ticket/86

A tested workaround with Lua and a single IF with a return then:

location ~ \.php$ {
try_files $uri $uri/ =404;
set $mmode 0;
set_by_lua $notused '
s = 0;
local source_fname = ngx.var.document_root .. "/maintenance_mode.html";
local file = io.open(source_fname);
if file then ngx.var.mmode=1; file:close(); end;
s = string.find(ngx.var.remote_addr, "^10.10.20.");
if s then ngx.var.mmode=0; end;
';
if ($mmode) { return 503; }
index index.html index.htm index.php;
fastcgi_ignore_client_abort on;
fastcgi_pass myLoadBalancer;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

---
nginx for Windows http://nginx-win.ecsds.eu/
Subject Author Posted

Strange try_files behaviour

itpp2012 July 11, 2014 03:36PM

Re: Strange try_files behaviour

Maxim Dounin July 11, 2014 04:12PM

Re: Strange try_files behaviour

itpp2012 July 11, 2014 05:42PM

Re: Strange try_files behaviour

Valentin V. Bartenev July 11, 2014 06:08PM

Re: Strange try_files behaviour

itpp2012 July 11, 2014 06:21PM

Re: Strange try_files behaviour

itpp2012 July 12, 2014 06:23AM

Re: Strange try_files behaviour

Maxim Dounin July 13, 2014 05:16PM

Re: Strange try_files behaviour

itpp2012 July 13, 2014 05:46PM

Re: Strange try_files behaviour

Maxim Dounin July 13, 2014 06:22PM

Re: Strange try_files behaviour

itpp2012 July 14, 2014 12:44PM

Re: Strange try_files behaviour

itpp2012 July 15, 2014 05:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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