mirror of
https://github.com/gl-inet/glkvm-cloud.git
synced 2026-09-12 05:48:57 +00:00
739aa235b3
Update and clarify the documentation for reverse proxy mode, including usage guidelines and deployment considerations when running behind front-end proxies. Signed-off-by: GL.iNet-Yongping.Xie <yongping.xie@gl-inet.com>
88 lines
2.8 KiB
Plaintext
Executable File
88 lines
2.8 KiB
Plaintext
Executable File
# =========================================================
|
|
# GLKVM Cloud - Reverse Proxy Mode (Nginx Example)
|
|
#
|
|
# This configuration shows how to run GLKVM Cloud behind
|
|
# Nginx in reverse proxy mode.
|
|
#
|
|
# - TLS is terminated by Nginx
|
|
# - GLKVM Cloud listens on plain HTTP internally
|
|
# - Web UI and remote device access share the same HTTPS port
|
|
# - Routing is based on the requested domain name
|
|
# =========================================================
|
|
|
|
# WebSocket connection helper
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
# --- Web UI: https://www.example.com ---
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name www.example.com;
|
|
|
|
ssl_certificate /path/to/fullchain.pem;
|
|
ssl_certificate_key /path/to/privkey.pem;
|
|
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 10m;
|
|
|
|
location / {
|
|
proxy_http_version 1.1;
|
|
|
|
# Required forwarded headers for reverse proxy mode
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
# WebSocket support
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
|
|
# GLKVM Cloud web service (HTTP)
|
|
proxy_pass http://127.0.0.1:1443;
|
|
|
|
proxy_connect_timeout 10s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|
|
|
|
# --- Device Access: https://<device_id>.example.com ---
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name *.example.com;
|
|
|
|
ssl_certificate /path/to/fullchain.pem;
|
|
ssl_certificate_key /path/to/privkey.pem;
|
|
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 10m;
|
|
|
|
location / {
|
|
proxy_http_version 1.1;
|
|
|
|
# Required forwarded headers for reverse proxy mode
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
# WebSocket support
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
|
|
# GLKVM Cloud device access service (HTTP)
|
|
proxy_pass http://127.0.0.1:10443;
|
|
|
|
proxy_connect_timeout 10s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|