全球主机交流论坛

标题: 请教个反代问题~宝塔反向代理出错 [打印本页]

作者: xiaotangke    时间: 2024-7-21 11:06
标题: 请教个反代问题~宝塔反向代理出错
本帖最后由 xiaotangke 于 2024-7-21 11:31 编辑

请教个问题,

服务器A 1.2.3.4
服务器B 4.3.2.1
域名 a.b.c

服务器B是源站,用A反代它

反代配置就写http://4.3.2.1,域名是a.b.c



AB两台都安装宝塔,A上面 域名a.b.c 修改 hosts为4.3.2.1,并设置反向代理,现在访问域名,网站打不开,是为啥?

  1. #PROXY-START/

  2. location ^~ /
  3. {
  4.     proxy_pass http://4.3.2.1;
  5.     proxy_set_header Host a.b.c;
  6.     proxy_set_header X-Real-IP $remote_addr;
  7.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  8.     proxy_set_header REMOTE-HOST $remote_addr;
  9.     proxy_set_header Upgrade $http_upgrade;
  10.     proxy_set_header Connection $connection_upgrade;
  11.     proxy_ssl_server_name on;
  12.     proxy_cache pingtan;
  13.     proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  14.     proxy_http_version 1.1;
  15.     # proxy_hide_header Upgrade;

  16.     add_header X-Cache $upstream_cache_status;
  17.     #Set Nginx Cache

  18.     set $static_filempd4THKr 0;
  19.     if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
  20.     {
  21.         set $static_filempd4THKr 1;
  22.         expires 1m;
  23.     }
  24.     if ( $static_filempd4THKr = 0 )
  25.     {
  26.         add_header Cache-Control no-cache;
  27.     }
  28. }
  29. #PROXY-END/
复制代码

作者: 她说吞过他的它    时间: 2024-7-21 11:21
求同
作者: wps    时间: 2024-7-21 11:32
B配ssl证书了?没的话不得用http://
作者: iks    时间: 2024-7-21 11:40
原站配了 https?
作者: —。—    时间: 2024-7-21 11:51
不会是最低级的错误      域名没有解析到A上吧   
作者: xiaotangke    时间: 2024-7-21 12:40
本帖最后由 xiaotangke 于 2024-7-21 12:59 编辑
wps 发表于 2024-7-21 11:32
B配ssl证书了?没的话不得用http://


源站 B 配了SSL 证书,未开启强制https
作者: 1069    时间: 2024-7-21 12:41
明显设置有问题
关IP什么事
作者: xiaotangke    时间: 2024-7-21 12:58
iks 发表于 2024-7-21 11:40
原站配了 https?

源站B 配了SSL 证书,未开启强制https
作者: xiaotangke    时间: 2024-7-21 13:01
1069 发表于 2024-7-21 12:41
明显设置有问题
关IP什么事

是啊 没找到问题。。。
作者: iks    时间: 2024-7-21 13:02
xiaotangke 发表于 2024-7-21 12:58
源站B 配了SSL 证书,未开启强制https

第 6 行,https
第 13 行,下起一行 proxy_ssl_name $host;
作者: greyboy    时间: 2024-7-21 14:27
面板反代那里 你ip:80试试看  开启ssl默认会往443上
作者: xiaotangke    时间: 2024-7-21 22:33
greyboy 发表于 2024-7-21 14:27
面板反代那里 你ip:80试试看  开启ssl默认会往443上

好的,谢谢。我试试看
作者: TangRenGuan    时间: 2024-7-22 01:09
一起学习
作者: oneer5    时间: 2024-7-22 17:46
会不会是IP 有问题?




欢迎光临 全球主机交流论坛 (https://loc.isir333.eu.org/) Powered by Discuz! X3.4