I cant wrap my mind about where I combine nginx and openresty togther
I have this simple configure:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
error_log logs/error.log debug;
if_modified_since Off;
lua_check_client_abort On;
resolver 127.0.0.1;
lua_package_path '/opt/ledge/lua-ffi-zlib/lib/?.lua;/opt/ledge/lua-resty-http/lib/?.lua;/opt/ledge/lua-resty-redis-connector/lib/?.lua;/opt/ledge/lua-resty-qless/lib/?.lua;/opt/ledge/lua-resty-cookie/lib/?.lua;/opt/ledge/ledge/lib/?.lua;;';
init_by_lua_block {
local ledge_m = require "ledge.ledge"
ledge = ledge_m.new()
ledge:config_set("esi_enabled", true)
ledge:config_set("redis_host", { host = "<redis_ip>", port = 6379, password = "<password_here>", socket = nil})
ledge:config_set("upstream_host", "<php_server_ip>")
}
init_worker_by_lua_block {
ledge:run_workers()
}
server {
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
proxy_pass http://<php_server_ip>$uri;
}
location / {
content_by_lua_block {
ngx.req.clear_header('Cache-Control')
ngx.req.clear_header('Pragma')
ledge:bind("origin_fetched", function(res)
res.header["Cache-Control"] = "max-age=9999999"
end)
ledge:run()
}
}
}
}
so right now in cache miss I send the request to other "normal" nginx server that fastcgi_pass the request to php, is there a way to remove the middleware nginx server, and in cache miss directly connect to fastcgi ?