Haproxy Apache粘性会话PHPSESSID

时间:2018-10-27 14:02:56

标签: php apache haproxy

我具有Haproxy的此配置:

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
        tune.ssl.default-dh-param 2048
        user haproxy
        group haproxy
        daemon

        # Default SSL material locations
        ca-base /etc/apache2/ssl/certs
        crt-base /etc/apache2/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 ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
        ssl-default-bind-options no-sslv3

defaults
        log     global
        option  httplog
        option  dontlognull
        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 http_front
   bind *:80
   mode http
   option httplog
   default_backend http_back

frontend https_front
   bind *:443
   mode tcp
   option tcplog
   default_backend https_back

backend http_back
   mode http
   balance roundrobin
   option forwardfor
   cookie PHPSESSID prefix nocache
   server Apache1 XX.XX.XX.XX:80 cookie 1 check
   server Apache2 XX.XX.XX.XX:80 cookie 2 check

backend https_back
   mode tcp
   balance roundrobin
   option forwardfor
   cookie PHPSESSID prefix nocache
   server Apache1 XX.XX.XX.XX:443 cookie 1 check
   server Apache2 XX.XX.XX.XX:443 cookie 2 check

我创建了两个后端,一个用于http,另一个用于https,因为我在http上有一些站点,而在https上有其他站点,此配置有效,但不适用于ssl上的PHPSESSID cookie(无需ssl即可工作)。 / p>

会话不固定,我已经登录,并且在5或6次重新加载后都断开了连接。

我也用:

cookie SERVERID insert indirect nocache

但同样的问题。

配置出了什么问题?

谢谢你。

0 个答案:

没有答案