【发布时间】:2021-08-20 23:03:29
【问题描述】:
是否可以将配置参数(在haproxy.cfg 中)拆分为多行?
示例
当前
frontend
https-in bind :443 ssl strict-sni crt </path/to/cert1.pem> crt </path/to/cert2.pem> crt </path/to/cert3.pem> ...
理想
frontend
https-in bind :443 ssl strict-sni
crt </path/to/cert1.pem>
crt </path/to/cert2.pem>
crt </path/to/cert3.pem>
...
尝试理想时出错
$ /usr/sbin/haproxy -c -V -f /etc/haproxy/haproxy.cfg
[ALERT] 343/210133 (25646) : parsing [/etc/haproxy/haproxy.cfg:45] : unknown keyword 'crt' in 'frontend' section
[ALERT] 343/210133 (25646) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 343/210133 (25646) : Fatal errors found in configuration.
【问题讨论】:
-
分割线遇到什么问题?
-
@JeroenHeier 我收到此错误:[ALERT] 343/210133 (25646):解析 [/etc/haproxy/haproxy.cfg:45]:“前端”部分中的未知关键字“crt”
-
(编辑)向问题添加了 configtest 输出。
-
你是如何生成配置文件的?如果这些方法允许您可以从生成代码中的变量或类似内容进行填充,以便更轻松地编写配置。例如,我们通过厨师食谱生成配置,因此不直接在 haproxy.cfg 中设置任何内容,而是通过变量。
-
您可以将
crt-list文件名与所有证书路径一起使用。它会很干净。
标签: haproxy