chore(nginx): use environment variables for gunicorn
This commit is contained in:
@@ -9,6 +9,10 @@ worker_processes auto;
|
||||
worker_cpu_affinity auto;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
# gunicorn
|
||||
env LISTEN_HOST;
|
||||
env LISTEN_PORT;
|
||||
|
||||
# link configuration
|
||||
env CIPHERSERVER_PORT_8001_TCP_ADDR;
|
||||
env CIPHERSERVER_PORT_8001_TCP_PORT;
|
||||
@@ -130,7 +134,17 @@ http {
|
||||
|
||||
# Authentication and proxying
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
# gunicorn host
|
||||
set_by_lua_block $gunicorn_host {
|
||||
return os.getenv('LISTEN_HOST') or '127.0.0.1'
|
||||
}
|
||||
|
||||
# gunicorn port
|
||||
set_by_lua_block $gunicorn_port {
|
||||
return os.getenv('LISTEN_PORT') or '8080'
|
||||
}
|
||||
|
||||
proxy_pass http://$gunicorn_host:$gunicorn_port;
|
||||
proxy_set_header Host localhost:$proxy_port;
|
||||
proxy_set_header X-Forwarded-Host $x_forwarded_host;
|
||||
proxy_set_header X-Forwarded-Port $x_forwarded_port;
|
||||
|
||||
Reference in New Issue
Block a user