the nginx code below :
if detected
example.com/prefixurl_123
example.com/prefixurl_456
example.com/prefixurl_789
location ~ /prefixurl_ {
default_type 'text/html';
content_by_lua '
local redis = require "resty.redis"
local red = redis:new()
local ok, err = red:connect("127.0.0.1", 6379)
local hostheader = ngx.req.get_headers()["Host"];
local requesturi = ngx.var.request_uri;
ok, err = red:hget(hostheader, requesturi)
if (string.len(ok) >= 10) then
ngx.say(ok)
return
end
';
}
problem:
if example.com/prefixurl_XXX <- not found it will return
File not found
how can i make it so that it does... the below? try_files etc? coz i want it to run .php or below if it cannot find the file inside redis.
location / {
try_files $uri $uri/ /index.php?$args ;
}