forked from leandromoreira/cdn-up-and-running
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5af21fe
commit 1d213f9
Showing
5 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
env BACKEND_HOST; # allow list for os.getenv | ||
env BACKEND_PORT; # allow list for os.getenv | ||
|
||
upstream backend { | ||
server 0.0.0.1; # just an invalid address as a place holder | ||
|
||
balancer_by_lua_block { | ||
local balancer = require "ngx.balancer" | ||
local host = os.getenv("BACKEND_HOST") | ||
local port = number(os.getenv("BACKEND_PORT")) | ||
|
||
local ok, err = balancer.set_current_peer(host, port) | ||
if not ok then | ||
ngx.log(ngx.ERR, "failed to set the current peer: ", err) | ||
return ngx.exit(500) | ||
end | ||
} | ||
|
||
keepalive 10; # connection pool | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
proxy_cache zone_1; | ||
proxy_cache_key $cache_key; | ||
proxy_cache_lock on; | ||
proxy_http_version 1.1; | ||
proxy_set_header Connection ""; | ||
proxy_buffering on; | ||
proxy_buffers 16 16k; | ||
add_header X-Cache-Status $upstream_cache_status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
proxy_cache_path /cache/ levels=2:2 keys_zone=zone_1:10m max_size=10m inactive=10m use_temp_path=off; | ||
proxy_cache_lock_timeout 1s; | ||
proxy_cache_use_stale error timeout updating; | ||
proxy_read_timeout 1s; | ||
proxy_send_timeout 1s; | ||
proxy_ignore_client_abort on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters