
나에겐 서버가 3개 있다
--> haproxy - server1(uk)
- server2(ru)
나는 팔로우했다이 튜토리얼ru.subnets에 대한 IP를 생성했습니다.
이제 내 /etc/haproxy에 다음 파일이 있습니다.
haproxy.conf
ru.subnets
내 haproxy.conf에서:
frontend http-frontend
bind *:80
mode http
reqadd X-Forwarded-Proto:\ http
acl blog_acl path_beg /wp-admin
acl ru_acl src -f RU.subnets
use_backend wwwru if ru_acl
use_backend wwwbackend if !ru_acl
use_backend wwwru if blog_acl
default_backend wwwbackend
모든 것이 괜찮아 보이지만 haproxy에서 구성 파일을 로드하려고 하면 다음 오류가 발생합니다.
[ALERT] 170/084453 (4661) : parsing [/etc/haproxy/haproxy.cfg:37] : error detected while parsing ACL 'ru_acl'.
[ALERT] 170/084453 (4661) : parsing [/etc/haproxy/haproxy.cfg:39] : error detected while parsing switching rule.
[ALERT] 170/084453 (4661) : parsing [/etc/haproxy/haproxy.cfg:40] : error detected while parsing switching rule.
[ALERT] 170/084453 (4661) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 170/084453 (4661) : Fatal errors found in configuration.
답변1
대신 이것을 시도해 보세요 :-)
frontend http-frontend
bind *:80
mode http
reqadd X-Forwarded-Proto:\ http
acl blog_acl path_beg /wp-admin
use_backend wwwru if { src -f RU.subnets }
use_backend wwwbackend { src -f RU.subnets }
use_backend wwwru if blog_acl
default_backend wwwbackend