Spaces:
Sleeping
Sleeping
user service service; | |
worker_processes auto; | |
pid /tmp/nginx.pid; | |
events { | |
worker_connections 768; | |
} | |
http { | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 65; | |
types_hash_max_size 2048; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
access_log /tmp/nginx_access.log; | |
error_log /tmp/nginx_error.log; | |
gzip on; | |
server { | |
listen 7860; | |
server_name localhost; | |
# Force inclusion of port in redirects | |
port_in_redirect on; | |
absolute_redirect off; | |
# Preserve original scheme (http or https) | |
set $origin_scheme $scheme; | |
if ($http_x_forwarded_proto = "https") { | |
set $origin_scheme "https"; | |
} | |
# cAdvisor | |
location /cadvisor/ { | |
proxy_pass http://localhost:8080/; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $origin_scheme; | |
proxy_read_timeout 90; | |
proxy_http_version 1.1; | |
proxy_redirect off; | |
# Rewrite the URL to remove /cadvisor/ before passing to cAdvisor | |
rewrite ^/cadvisor/(.*) /$1 break; | |
# Handle cAdvisor's redirect and resource paths | |
sub_filter_once off; | |
sub_filter 'href="../' 'href="/cadvisor/'; | |
sub_filter 'src="../' 'src="/cadvisor/'; | |
sub_filter 'url("../' 'url("/cadvisor/'; | |
sub_filter 'action="../' 'action="/cadvisor/'; | |
sub_filter '<a href="/' '<a href="/cadvisor/'; | |
} | |
# Handle the /containers/ redirect from cAdvisor | |
location /containers/ { | |
return 301 $origin_scheme://$host:$server_port/cadvisor/containers/; | |
} | |
# Redirect /cadvisor to /cadvisor/ | |
location = /cadvisor { | |
return 301 $origin_scheme://$host:$server_port/cadvisor/; | |
} | |
# Root location | |
location = / { | |
return 302 $origin_scheme://$http_host/reaspeech/; | |
} | |
# Main application | |
location /reaspeech { | |
proxy_pass http://localhost:9000; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $origin_scheme; | |
} | |
location /asr { | |
proxy_pass http://localhost:9000; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $origin_scheme; | |
} | |
location /jobs { | |
proxy_pass http://localhost:9000; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $origin_scheme; | |
} | |
location /static/ { | |
alias /app/app/static/; | |
} | |
} | |
} |