去年有大概1年时间,我的博客因服务器到期,续费太贵,因此将我的博客站点及其他部分站一起迁移到了本地。用了一年的免费代理服务器,但是在这段时间不稳定,因此决定将博客再次搬到云服务器上,其他站点通过反向代理实现。大部分站点都是ipv4,都OK了,唯独Cloudreve的8443端口是ipv6,发现一直返回502。查了一下报错日志如下。
[error] 25148#0: *5864 SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream, client: xxx.xxx.xxx.xxx, server: xxx.xxx, request: "GET /dav/bookmarks.xbel.lock HTTP/2.0", upstream: "https://127.0.0.1:909/dav/bookmarks.xbel.lock", host: "xxx.xxx
代理服务用的是宝塔+NGINX,代码如下:
location ^~ /
{
proxy_pass https://127.0.0.1:909;
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 REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_http_version 1.1;
}
最后修改为以下代码:
location ^~ /
{
proxy_pass https://127.0.0.1:909;
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_ssl_session_reuse off;
proxy_ssl_server_name on;
proxy_ssl_name $host;
proxy_ssl_protocols TLSv1.2;
}
最新评论