HuggingRun / nginx.conf
tao-shen's picture
v2: complete redesign β€” single entrypoint, tar.zst persistence
52013b5
worker_processes 1;
pid /tmp/nginx.pid;
error_log /tmp/nginx-error.log warn;
events {
worker_connections 256;
}
http {
access_log off;
client_body_temp_path /tmp/nginx-body;
proxy_temp_path /tmp/nginx-proxy;
fastcgi_temp_path /tmp/nginx-fastcgi;
uwsgi_temp_path /tmp/nginx-uwsgi;
scgi_temp_path /tmp/nginx-scgi;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 7860;
# /ssh β†’ WebSocket-to-SSH bridge
location /ssh {
proxy_pass http://127.0.0.1:7862;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
}
# /runlog β†’ full log file (static)
location = /runlog {
default_type text/plain;
add_header Cache-Control "no-cache, no-store";
alias /var/log/huggingrun.log;
}
# /runlog/stream β†’ SSE real-time log stream
location /runlog/stream {
proxy_pass http://127.0.0.1:7863/stream;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_cache off;
chunked_transfer_encoding off;
proxy_read_timeout 86400;
}
# Everything else β†’ ttyd web terminal
location / {
proxy_pass http://127.0.0.1:7681;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
}
}
}