
다음 명령을 사용하여 소스에서 Haproxy LTS 2.2 버전을 컴파일했습니다.
make TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_CRYPT_H=1 USE_LIBCRYPT=1
컴파일하는 동안 오류가 발생하지 않았습니다. 이것은 내 Haproxy 구성입니다.
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
frontend http-in
bind 192.168.123.40:80
acl gerrit hdr(host) -i gerrit.example.local
acl jenkins hdr(host) -i jenkins.example.local
use_backend gerrit if gerrit
use_backend jenkins if jenkins
backend gerrit
server gerrit 127.0.0.1:8080
backend jenkins
server jenkins 127.0.0.1:8081
명령 으로 구성을 확인할 때 haproxy -c -q -V -f /etc/haproxy/haproxy.cfg
다음 오류가 발생합니다.
[NOTICE] 226/130914 (35193) : haproxy version is 2.2.2
[NOTICE] 226/130914 (35193) : path to executable is /usr/sbin/haproxy
[ALERT] 226/130914 (35193) : parsing [/etc/haproxy/haproxy.cfg:33] : unknown keyword 'bind 192.168.123.40:80' in 'frontend' section
[ALERT] 226/130914 (35193) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 226/130914 (35193) : Fatal errors found in configuration.
문서를 확인했는데 사용이 허용되었습니다.bind
문서를 확인했는데 프런트엔드 섹션에서 키워드를
http://cbonte.github.io/haproxy-dconv/2.2/configuration.html#bind(알파벳순으로 정렬된 키워드 참조)
bind
프론트엔드 섹션에서 키워드를 주석 처리하면 더 많은 정신 나간 일이 달성됩니다 . 그런 다음 오류가 발생합니다.
[WARNING] 226/132456 (36642) : config : frontend 'http-in' has no 'bind' directive. Please declare it as a backend if this was intended.
답변1
bind
이는 공백처럼 보이지만 실제로 는 와 사이에 일반 공백 문자가 아닌 다른 공백 문자를 사용한 것처럼 보입니다 192.168.123.40:80
. 텍스트를 다시 입력해 보십시오. 단, 이번에는 일반 공백(U+0020, ASCII 32)을 사용하십시오.