user nginx; worker_processes auto; 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; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 65; server { listen 7860; # --- 新增配置:处理根路径 / 的请求 --- location / { # 返回一个简单的HTML页面 return 200 ' My Node.js Services

Welcome to My Node.js Services

Choose a service to access:

Go to App 1 Go to App 2 Go to App 3
'; # 指定返回内容的类型 add_header Content-Type text/html; } # ----------------------------------- location /app1/ { proxy_pass http://127.0.0.1:3001/; proxy_set_header Host $host; } location /app2/ { proxy_pass http://127.0.0.1:3002/; proxy_set_header Host $host; } location /app3/ { proxy_pass http://127.0.0.1:3003/; proxy_set_header Host $host; } } }