【问题标题】:Haproxy config for bitbucket serverBitbucket 服务器的 Haproxy 配置
【发布时间】:2016-11-01 14:15:36
【问题描述】:

我正在使用 haproxy 将端口转发到 Bitbucket 服务器 ssh。这是 haproxy 配置:

frontend sshd
        bind *:7999
        default_backend ssh
        timeout client 1h

backend ssh
        mode tcp
        server localhost-bitbucket-ssh 127.0.0.1:7999 check port 7999

如果我这样做:

sudo haproxy -f haproxy.cfg

我收到以下错误:

[ALERT] 305/201411 (4168) : http frontend 'sshd' (haproxy.cfg:38) tries to use incompatible tcp backend 'ssh' (haproxy.cfg:43) as its default backend (see 'mode').
[ALERT] 305/201411 (4168) : Fatal errors found in configuration.

但我指的是官方 atlassian 指南:https://confluence.atlassian.com/bitbucketserver/setting-up-ssh-port-forwarding-776640364.html 他们错了吗?

另外,如果我在 bitbucket 服务器之前启动 haproxy,bitbucket 服务器无法在端口 7999 上启动。我完全糊涂了。我已经为那个软件付费了,现在我需要自己弄清楚如何配置它超过 2 天...

更新

正如 Thomj 所说,这是 UFW。但是出于什么目的我需要 haproxy?如果我不能将 Bitbucket 的 ssh 绑定到 22 端口?我不喜欢设置端口号。

【问题讨论】:

    标签: java haproxy bitbucket-server


    【解决方案1】:

    前端配置默认为 http 模式,它不能使用为 tcp 配置的后端。尝试在前端添加“mode tcp”:

    frontend sshd
            bind *:7999
            default_backend ssh
            timeout client 1h
            mode tcp
    

    【讨论】:

    • 谢谢,我之前试过这个,但它开始抱怨绑定套接字 0.0.0.0:7999。试过netstat -apn | grep ":7999" 它向我展示了java(bitbucket 服务器)。所以haproxy不会让bitbucket使用7999端口?
    • 您只能将一个进程绑定到一个端口。在这种情况下,您的 HAProxy 和 Bitbucket 服务器都在尝试绑定到 7999。您必须将其中一个配置为使用不同的端口。
    • 好吧,如果我在 bitbucket 上更改端口,我必须在 haproxy 中写什么?
    • 如果您更改 Bitbucket Server 中的端口,以便 SSH 监听端口 7998,例如,您将在 HAProxy 中拥有以下内容:frontend sshd bind *:7999 default_backend ssh timeout client 1h backend ssh mode tcp server localhost-bitbucket-ssh 127.0.0.1:7998 check port 7998
    • 当 haproxy 关闭时,如果我输入:alexander@server:/etc/haproxy$ ssh -p 7999 git@git.webium.me Permission denied (publickey). 如果我打开 haproxy,我会再次超时。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-08
    • 1970-01-01
    • 1970-01-01
    • 2019-01-03
    • 1970-01-01
    相关资源
    最近更新 更多