electerm / electerm-web

Running electerm as web app
https://electerm.html5beta.com
MIT License
66 stars 11 forks source link

nginx 反向代理 #8

Closed fnhchaiying closed 6 months ago

fnhchaiying commented 6 months ago

What feature you'd like to see or proposal(期望什么新功能/特性或者建议)

可使用nginx做反向代理,与其他服务共用域名和端口 例如: 已有域名: http://test.com 添加后的访问方式变为: http://test.com/electerm

我的nginx配置

map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
}
    server {
        listen 80
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_ignore_client_abort on;
        client_max_body_size 10G;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        location /electerm {
          proxy_pass http://127.0.0.1:5577;
        }
        location /{
          proxy_pass http://127.0.0.1/;
        }
    }
zxdong262 commented 6 months ago

可以试试在.env里设置

SERVER=http://test.com/electerm
CDN=http://test.com/electerm

试试

fnhchaiying commented 6 months ago

console中会有以下3个路径报404 GET https://test.com/favicon.ico 404 (Not Found) GET https://test.com/api 404 (Not Found) GET https://test.com/icons/ 404 (Not Found)

fnhchaiying commented 6 months ago

这3个路径可能与其他程序的冲突

zxdong262 commented 6 months ago

对于支持子路径,估计得改很多地方,如果你能控制域名解析,估计设个子域名解析更快

zxdong262 commented 6 months ago

另外websocket情况也得验证下,总之目前还没有验证对于部署到服务器的支持

fnhchaiying commented 6 months ago

感谢支持,我使用单独的端口来承载服务吧!