Files
SimpleRemoter/server/go/deploy/nginx-yama.conf.example
yuanyuanxianganddeepseek-v4-pro 42df128f62 Feature: Support subpath deployment for Go web UI
Add optional YAMA_WEB_BASE_PATH to mount the whole web UI (index, manifest,
static assets, /health, /api/devices, /ws) under a URL prefix such as
/remoter behind a reverse proxy. index.html now uses a __BASE_PATH__
placeholder substituted at serve time, the PWA manifest start_url is rooted
at the base path, and a mount wrapper redirects the bare prefix to prefix/
and strips it before routing. Include nginx, systemd, and env-file deployment
examples for the subpath setup.

The shared placeholder is also handled by the MFC server, which serves from
the domain root and strips __BASE_PATH__ (to "") so its web remote desktop
URLs stay rooted.

Co-Authored-By: deepseek-v4-pro
2026-09-11 12:48:21 +02:00

69 lines
2.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# YAMA 网页端 nginx 反代示例(方案B:子路径部署)
# 作为站点配置放入 /etc/nginx/sites-available/yama 后软链到 sites-enabled
# 核心原则:nginx 只做 TLS 终止 + 完整路径转发,由 Go 端
# YAMA_WEB_BASE_PATH=/remoter 负责 strip
# ============================================================
server {
listen 443 ssl http2;
server_name 你的域名.com;
# TLS 证书(路径换成你自己的,如 certbot/letsencrypt 生成的位置)
ssl_certificate /etc/letsencrypt/live/你的域名.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/你的域名.com/privkey.pem;
# 裸 /remoter(没写结尾斜杠)→ 301 到 /remoter/
location = /remoter {
return 301 /remoter/;
}
# 子路径:完整路径原样转发,Go 端按 YAMA_WEB_BASE_PATH 再 strip
location /remoter/ {
# 结尾没有 "/" → /remoter/... 原样转发(不要写成 http://127.0.0.1:8080/)
# Go 服务端若在另一台机器,换成 http://192.168.1.50:8080;
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
# WebSocket 升级(远程桌面走 /remoter/ws,不配这两行连不上)
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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 $scheme;
# 远程桌面连接长时间空闲,避免默认 60s 被 nginx 掐断
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
# 大文件/流式传输时避免缓冲占内存(可选)
# proxy_buffering off;
}
}
# ============================================================
# 方案A(根路径部署):不设 YAMA_WEB_BASE_PATH,用下面这段替代上面
# ============================================================
# server {
# listen 443 ssl http2;
# server_name 你的域名.com;
# ssl_certificate /etc/letsencrypt/live/你的域名.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/你的域名.com/privkey.pem;
#
# location / {
# proxy_pass http://127.0.0.1:8080;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# 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 $scheme;
# proxy_read_timeout 3600s;
# proxy_send_timeout 3600s;
# }
# }