Created
July 5, 2015 20:42
-
-
Save camathieu/d9a47cf018441f2752be to your computer and use it in GitHub Desktop.
plik nginx configuration
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
upstream plik { | |
server 127.0.0.1:8080; | |
server 127.0.0.1:8081; | |
} | |
upstream stream { | |
server 127.0.0.1:8080; | |
server 127.0.0.1:8081; | |
hash $key; | |
} | |
server { | |
listen 9000; | |
location / { | |
set $upstream ""; | |
set $key ""; | |
access_by_lua ' | |
_,_,key = string.find(ngx.var.request_uri, "^/stream/[a-zA-Z0-9]{16}/([a-zA-Z0-9]{16})/.*$") | |
if key == nil then | |
ngx.log(ngx.STDERR, "regular upload") | |
ngx.var.upstream = "plik" | |
else | |
ngx.log(ngx.STDERR, "stream upload") | |
ngx.var.upstream = "stream" | |
ngx.var.key = key | |
end | |
'; | |
proxy_pass http://$upstream; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment