Jireh程序猿的那些事 Jireh程序猿的那些事

记录分享生活、程序、信息的精彩人生

目录
TeslaMate+宝塔Nginx反代配置
/    

TeslaMate+宝塔Nginx反代配置

关于安装的部份这里就不在做阐述了,详细的操作步骤可以参考https://zhuanlan.zhihu.com/p/437404623 这里的安装指南。


以下为关于Nginx反代的配置,默认的配置会导致websocket访问错误,页面无法正常加载

image.png

在站点的配置中添加

map $http_upgrade $connection_upgrade { 
	default upgrade; 
	'' close; 
}

image.png

在反向代理配置中添加

location ^~ /
{
    proxy_pass https://127.0.0.1:12443;
    proxy_http_version 1.1;
	proxy_redirect off; 
	proxy_set_header Host $host; 
	proxy_set_header X-Real-IP $remote_addr; 
	proxy_read_timeout 3600s; 
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
	proxy_set_header Upgrade $http_upgrade; 
	proxy_set_header Connection $connection_upgrade; 
}

如果觉得这篇文章不错的话,请我喝一杯 咖啡☕吧
标题:TeslaMate+宝塔Nginx反代配置
作者:Jireh
地址:https://www.jireh.xyz/articles/2022/03/31/1648692344568.html
本作品由 Jireh 采用 署名 – 非商业性使用 – 禁止演绎 4.0 国际许可协议进行许可,转载请注明出处。