Haproxy 多行配置
Haproxy multi-line config
是否可以将配置参数(在 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.
您不能在 haproxy.cfg 中使用多行语法。
查看文件格式文档:https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#2.1
更新:
感谢 Venky I see that there is also the option to use crt-list
which does provide an option for multi line pem file references. https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.1-crt-list
的评论
是否可以将配置参数(在 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.
您不能在 haproxy.cfg 中使用多行语法。
查看文件格式文档:https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#2.1
更新:
感谢 Venky I see that there is also the option to use crt-list
which does provide an option for multi line pem file references. https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.1-crt-list