50 lines
1.2 KiB
Nginx Configuration File
50 lines
1.2 KiB
Nginx Configuration File
worker_processes 1;
|
|
error_log /var/log/nginx/error.log warn;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
sendfile on;
|
|
keepalive_timeout 65;
|
|
|
|
# Upstream: Node.js API + static frontend + WebSocket PTY
|
|
upstream api {
|
|
server 127.0.0.1:4000;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# WebSocket terminal — /shell-ws is handled by the Node.js backend
|
|
location /shell-ws {
|
|
proxy_pass http://api;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_read_timeout 7d;
|
|
}
|
|
|
|
# API routes
|
|
location /api/ {
|
|
proxy_pass http://api;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
}
|
|
|
|
# Everything else → React SPA (served by same Node.js process)
|
|
location / {
|
|
proxy_pass http://api;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
}
|
|
}
|
|
}
|