bug宝典Linux篇 ALERT] 121/164316 (38066) : parsing [/etc/haproxy/haproxy.cfg:56] : 'bind *:9091' unknow

bug宝典Linux篇 ALERT] 121/164316 (38066) : parsing [/etc/haproxy/haproxy.cfg:56] : 'bind *:9091' unknow

按照Centos7 haproxy1.7 安装haproxy, 
然后在我的haproxy.cfg中添加bind :9091 ssl crt /application/ca/server-cert.pem crt /etc/cert/certdir/的配置,启动服务的时候,提示异常


global
    #设置日志
    log 127.0.0.1 local3 info
    chroot /usr/local/haproxy
    #用户与用户组
    user root
    group root
    #守护进程启动
    daemon
    #最大连接数
    maxconn 4000

#默认配置
defaults
    log global
    mode http
    option httplog
    option dontlognull
    timeout connect 5000
    timeout client 50000
    timeout server 50000

#前端配置,http_front名称可自定义
frontend http_back
    # 发起http请求道80端口,会被转发到设置的ip及端口
    bind *:80
    #haproxy的状态管理页面,通过/haproxy?stats来访问
    stats uri /haproxy?stats
    default_backend http_back

#后端配置,http_back名称可自定义
backend http_back
    #负载均衡方式
    #source 根据请求源IP
    #static-rr 根据权重
    #leastconn 最少连接者先处理
    #uri 根据请求的uri
    #url_param 根据请求的url参数
    #rdp-cookie 据据cookie(name)来锁定并哈希每一次请求
    #hdr(name) 根据HTTP请求头来锁定每一次HTTP请求
    #roundrobin 轮询方式
    balance roundrobin
    #设置健康检查页面
    #option httpchk GET /index.html
    #传递客户端真实IP
    option forwardfor header X-Forwarded-For
    # inter 2000 健康检查时间间隔2秒
    # rise 3 检测多少次才认为是正常的
    # fall 3 失败多少次才认为是不可用的
    # weight 30 权重
    # 需要转发的ip及端口
    server node1 192.168.4.187:8093 check inter 2000 rise 3 fall 3 weight 30

frontend thrift_front
    bind :9091 ssl crt /application/ca/server-cert.pem crt /etc/cert/certdir/
    mode tcp
    log global
    option tcplog
    timeout client 3600s
    backlog 4096
    maxconn 50000
    default_backend thrift_back

backend thrift_back
     mode tcp
   option log-health-checks
   option redispatch
   option tcplog
   balance roundrobin
   timeout connect 1s
   timeout queue 5s
   timeout server 3600s
   server s1 192.168.4.187:9091 check
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75

详细异常信息如下:

[root@ceshi185 haproxy]# service haproxy start
[ALERT] 121/164316 (38066) : parsing [/etc/haproxy/haproxy.cfg:56] : 'bind *:9091' unknown keyword 'ssl'. Registered keywords :
    [STAT] level <arg>
    [ TCP] defer-accept
    [ TCP] interface <arg>
    [ TCP] mss <arg>
    [ TCP] transparent
    [ TCP] v4v6
    [ TCP] v6only
    [UNIX] gid <arg>
    [UNIX] group <arg>
    [UNIX] mode <arg>
    [UNIX] uid <arg>
    [UNIX] user <arg>
    [ ALL] accept-netscaler-cip <arg>
    [ ALL] accept-proxy
    [ ALL] backlog <arg>
    [ ALL] id <arg>
    [ ALL] maxconn <arg>
    [ ALL] name <arg>
    [ ALL] nice <arg>
    [ ALL] process <arg>
[ALERT] 121/164316 (38066) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 121/164316 (38066) : Fatal errors found in configuration.
Errors found in configuration file, check it with 'haproxy check'.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

执行命令haproxy -vv 
1 
这个意思是我安装的时候并没有使用openssl, 
解决方案参考Haproxy with SSL doesn’t works 
重新安装haproxy,关键是下面的步骤,其余的按照 Centos7 haproxy1.7 安装来执行

tar -zxvf haproxy-1.7.5.tar.gz
ln -s haproxy-1.7.5 haproxy
cd haproxy
make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 
  • 1
  • 2
  • 3
  • 4

再次检查 
2
再次启动haproxy,提示异常 
2
解决方案是将server-key.pem和server-cert.pem合在一个文件中 
2

frontend thrift_front
    bind :9091 ssl crt /application/ca/server.pem
    mode tcp
    log global
    option tcplog
    timeout client 3600s
    backlog 4096
    maxconn 50000
    default_backend thrift_back
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要访问http://localhost:8080/swagger-ui/index.html,您需要先进行一些操作。首先,您可以使用克隆应用程序命令来获取swagger-ui-akka-http的项目源代码。命令如下:sbt new knoldus/swagger-ui-akka-http.g8,然后进入项目目录:cd swagger-ui-akka-http。 接下来,您需要编译应用程序。您可以使用以下命令进行编译:sbt clean compile。这将确保项目的代码编译正确。 一旦编译成功,您可以运行应用程序。使用sbt run命令来启动应用程序。这将使您能够在本地主机上的端口8080上访问应用程序的URI:localhost:8080/swagger-ui/index.html。 请注意,在访问URL时,有时会出现错误,例如"error parsing http request header"。如果您遇到此问题,请尝试登录的URL地址,并确保正确登录后再次尝试访问目标URL。 另外,请注意在URL的末尾添加"#/”,有时可能需要这样做。这可能是因为特定应用程序或网站的要求,用于正确导航到所需的资源或页面。所以,如果您遇到问题,请尝试在URL末尾添加"#/”。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [swagger-ui-akka-http.g8:使用Akka Http API生成Swagger UI](https://download.csdn.net/download/weixin_42143806/18703738)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Swagger登录地址(首次登录可能会报错)](https://blog.csdn.net/weixin_46213083/article/details/125167028)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值