>10.22.12.54 haproxy IP 地址
10.22.12.55 阿帕奇网络 IP 地址
FQDN hasan.example.com 10.22.12.54 中解决
在我的haproxy配置中
global
log /dev/log local0
log /dev/log local1 notice
maxconn 100000
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd
listeners
stats timeout 30s
user haproxy
group haproxy
daemon
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
defaults
log global
mode tcp
maxconn 1000000
option httplog
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend Front-"443"
bind *:443
mode tcp
use_backend hasan
backend hasan
mode tcp
option ssl-hello-chk
server hasan 10.22.12.55:443 send-proxy-v2
APACHE WEB CONFIG
<VirtualHost *:443>
ServerName hasan.example.com:443
DocumentRoot /var/www/html/
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel debug
SSLProxyEngine on
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA
SSLCertificateFile /etc/httpd/conf.d/ssl/cert.pem
SSLCertificateKeyFile /etc/httpd/conf.d/ssl/key.pem
LogFormat "%a %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
CustomLog "logs/ssl_access_hasan_log" combined
ErrorLog "logs/ssl_errors_hasan.log
</VirtualHost>
远程 IP 配置(远程 IP(配置。
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 10.22.12.54
注意:
我的证书 CN 在 apache 服务器名称指令中相同
我的证书和私钥位于
haproxy:
/etc/ssl/certs/and/etc/ssl/private/Apache Web:/etc/httpd/conf.d/ssl
在阿帕奇日志中,我观察到
[2019 年 8 月 15 日星期四 11:36:23.368657] [SSL:信息] [PID 4058] SSL 库错误:错误:140760FC:SSL 例程:SSL23_GET_CLIENT_HELLO:未知协议 - 说不是 SSL 到 HTTPS 端口!? [周四8月15日 11:36:23.368660 2019][SSL:信息][PID 4058][客户端 10.22.12.54:41800]AH01998:与子项 2 的连接关闭,并中止关闭(服务器 hasan.example.com:443( [周四8月15日 11:36:24.704663 2019][SSL:信息][PID 4056][客户端 10.22.12.54:41804]AH01964:已建立与子级 0 的连接(服务器 hasan.example.com:443( [周四8月15日 11:36:24.704820 2019][SSL:信息][PID 4056][客户端 10.22.12.54:41804]AH02008:握手中的 SSL 库错误 1(服务器 hasan.example.com:443( [周四 8 月 15 日 11:36:24.704840 2019][SSL:信息][PID 4056]SSL 库错误: 错误:140760FC:SSL 例程:SSL23_GET_CLIENT_HELLO:未知协议 -- 不是 SSL 到 HTTPS 端口!?
注意:
没有发送代理,一切都可以正常工作。
但我需要使用
1( 在 HAPROXY 中使用 TCP 模式
2( 在 HAPROXY 后端发送代理
3( Apache Web 端的远程 IP 模块
来自基本 CentOS 7 存储库的最新版本(当我使用 yum install httpd 时( 看不懂 "远程 IPProxyProtocol On">
在最新的 apt 存储库中也有同样的情况。
当我**从源代码编译 apache httpd 时,我解决了这个问题。