zoukankan      html  css  js  c++  java
  • haproxy 配置https 同时技持443 80端口

     确定haproxy支持https

    [root@c01 sbin]# ldd haproxy |grep ssl
    	libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f961911c000)
    

    整合证书和私钥:

    # cat 213978673141013.key 213978673141013.pem |tee server.pen
    

    查看配置文件:

        global
                log 127.0.0.1 local0 info #[err warning info debug] //日志位置  
                tune.ssl.default-dh-param 2048 #修改默认使用2048bit加密,不设置会有警告
                maxconn 4096
                daemon #设置成后台运行  
                nbproc 1 #进程数量  
                pidfile /apps/haproxy-1.7.7/haproxy.pid
    
        defaults
                log     global
                mode    http #默认模式  
                option  httplog #http日志格式  
                option  dontlognull
                retries 3  #三次失败后认为服务器不可用  
                option  redispatch  #如果cookie写入了serverId而客户端不会刷新cookie,当serverId对应的服务器挂掉后,强制定向到其他健康的服务器  
                maxconn 2000 #当服务器负载很高的时候,自动结束掉当前队列处理比较久的链接默认的最大连接数  
                contimeout 5000 #连接超时  
                clitimeout 30000 #客户端超时  
                srvtimeout 30000 #服务器超时  
    
        frontend web_in
                mode http
                maxconn 1000
                bind *:80 
                bind *:443 ssl crt /etc/cert/server.pem 
                reqadd X-Forwarded-Proto: https #HTTP,HTTPS并存
                #redirect scheme https if !{ ssl_fc } 
                acl is_a hdr_beg(host) -i ssl.espressos1.com  #判断域名是不是www.espressos1.com,是则给与a服务器集群服务  
    
                use_backend a_server if is_a
          
        backend a_server  
                mode http #http 模式  
                stats   uri  /haproxy  
                balance roundrobin
                cookie  JSESSIONID prefix  
                stats   hide-version
                option  httpclose  
                server web1 10.100.0.220:80 check
                #server web2 128.1.2.5:80 check 
    
  • 相关阅读:
    [daily][dpdk] 内核模块(网卡驱动)无法卸载
    [development][tcp/ip][ids] 一个简单有参考价值的库 libnids
    [development][http][libhtp] suricata的http库--libhtp
    [skill][http] http管道化连接
    [skill][telnet] 用telnet获取一个网页
    [daily][grub2] grub2修改内核选项
    [knowledge] big data things
    [knowledge][dpdk] open data plane
    [daily] docker
    [knowledge] 停止等待协议
  • 原文地址:https://www.cnblogs.com/bass6/p/7131671.html
Copyright © 2011-2022 走看看