首页 > 解决方案 > 如何设置 haproxy 会话和静态页面?

问题描述

我有这两个问题:

  1. HAProxy 会话

    通过负载均衡器登录 Jira/Confluence 的管理员管理页面,无法登录。如果登录到每个服务器,它可以登录到管理员管理页面。

  2. HAProxy 静态页面

    Jira 负载均衡器 IP 无法显示常规 CSS 页面。但如果访问不同的服务器,它们会很好。所以原因将是HAProxy中关于静态的配置。


添加/etc/haproxy/haproxy.cfg

#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend jira
    bind :::8080 v4v6
    # acl url_static       path_beg       -i /static /images /javascript /stylesheets
    # acl url_static       path_end       -i .jpg .gif .png .css .js

    # use_backend static          if url_static
    default_backend             jira

frontend confluence
    bind :::8090 v4v6
    # acl url_static       path_beg       -i /static /images /javascript /stylesheets
    # acl url_static       path_end       -i .jpg .gif .png .css .js

    # use_backend static          if url_static
    default_backend             confluence

#---------------------------------------------------------------------
# static backend for serving up images, stylesheets and such
#---------------------------------------------------------------------
# backend static
#    balance     roundrobin
#    server      static 127.0.0.1:4331 check

#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend jira
    balance     roundrobin
    cookie JSESSIONID prefix nocache
    server jira1 [IP1]:8080 check cookie jira1
    server jira2 [IP2]:8080 check cookie jira2

backend confluence
    balance     roundrobin
    cookie JSESSIONID prefix nocache
    server confluence1 [IP3]:8090 check cookie confluence1
    server confluence2 [IP4]:8090 check cookie confluence2

标签: sessionhaproxystatic-files

解决方案


推荐阅读