首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >HAProxy多重服务,反向代理,CERT名称无效

HAProxy多重服务,反向代理,CERT名称无效
EN

Server Fault用户
提问于 2019-03-28 16:32:11
回答 1查看 1.3K关注 0票数 0

我有一个安装了HAProxy的服务器。我正在尝试将我的公共ip连接到多个通过外部端口提供不同服务的服务器。

因此端口80将直接指向服务器1,端口100将转发到服务器2等。

到目前为止,这个部分还在工作,我很难从have服务器获得ssl证书来传递与证书的通信量。当我尝试访问其他站点时,主站点与haproxy一起运行。我得到以下错误。

代码语言:javascript
复制
NET::ERR_CERT_COMMON_NAME_INVALID

我已经做了相当多的浏览堆栈交换,谷歌,论坛。我已经从下面的配置中删除了I的第一部分。它们在我的配置中,在我的服务器上。我还从下面的配置中删除了密码。

少了什么?

代码语言:javascript
复制
global
    log /dev/log    local0
    log /dev/log    local1 notice
    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
    maxconn 2048
    tune.ssl.default-dh-param 2048

    # Default SSL material locations
    ca-base /etc/ssl/certs
    #ca-base /etc/haproxy/certs/
    crt-base /etc/ssl/private

    # Default ciphers to use on SSL-enabled listening sockets.
    # For more information, see ciphers(1SSL). This list is from:
    #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
    # An alternative list with additional directives can be obtained from
    #  https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
    ssl-default-bind-ciphers xxxx
    ssl-default-bind-options no-sslv3

defaults
    log     global
    mode    http
    option  httplog
    option  dontlognull
    timeout connect 5000
    timeout client  50000
    timeout server  50000
    option forwardfor
    option http-server-close
    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 504 /etc/haproxy/errors/504.http

    frontend www-http
    #bind x.x.x.250:80
    #bind x.x.x.26:2000
    bind *:80
    reqadd X-Forwarded-Proto:\ http

    acl url_red path_beg /red
    use_backend red-backend if url_red

    default_backend www-backend
    #default_backend www-backend

    #acl url_prox path_beg /prox
    #use_backend prox-beckend if url_prox

frontend www-https
    bind x.x.x.250:443 ssl crt /etc/haproxy/certs/roots.systems.pem
    #bind x.x.x.26:2000 ssl crt /etc/haproxy/certs/roots.systems.pem
    reqadd X-Forwarded-Proto:\ https
    acl letsencrypt-acl path_beg /.well-known/acme-challenge/
    use_backend letsencrypt-backend if letsencrypt-acl
    #default_backend www-backend

    acl url_prox path_beg /prox
    use_backend prox-backend if url_prox

    acl url_red path_beg /red
    use_backend red-backend if url_red

    default_backend www-backend

backend www-backend
    redirect scheme https if !{ ssl_fc }
    #server www-1 x.x.x.25:80 check
    #server www-2 x.x.x.27:2551 check
    server www-3 127.0.0.1:84 check

backend letsencrypt-backend
    server letsencrypt 127.0.0.1:54321

backend prox-backend
    redirect scheme https if !{ ssl_fc }
    server prox01 x.x.x.25:1457   check inter 2000

backend red-backend
    redirect scheme https if !{ ssl_fc }
    server www-1 x.x.x.26:2000   check

编辑:忘记提到,我确实有一个CNAME记录在我的领域,将转发所有子域名回公共IP的域名。

因此,当需要访问服务a时,转到test.example.com

EN

回答 1

Server Fault用户

发布于 2019-03-29 00:47:48

明白了。

运行"openssl x509 -in YourCert.pem -text -noout“并与https://www.ssllabs.com/ssltest/进行比较。

这证实了正在使用的旧证书。经过进一步的调查,配置文件中正在覆盖一个cert调用。这解决了证书问题。为了在一个公共ip上使用多个服务,需要使用这种配置技术:

代码语言:javascript
复制
acl is_site2 hdr(host) -i something.example.com
use_backend site2 if is_site2
票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/960477

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档