Hello,
I have a server with HAProxy & Docker, I have installed Wordpress on it, but it seems HAProxy cannot connect to Wordpress. On the server I have a certificate and Wordpress seems running.
I noticed that on the “stats” the Wordpress status is DOWN !
(I have other ‘backend’ between HAProxy & Docker that work… but this one :-P)
So, how can I debug and/or fix this problem, if someone has an idea please?
Here is the HAProxy config :
frontend https-in
bind *:80
bind *:443 ssl crt /usr/local/etc/haproxy/certs/socloze.com.pem
#http-request add-header X-Forwarded-Proto https
http-request redirect prefix https://www.%[hdr(host)] code 301 if { hdr(host) -i socloze.com }
http-request redirect prefix https://%[hdr(host)] code 301 if { hdr(host) -i www.socloze.com } !{ ssl_fc }
acl acl_blog hdr(host) -i blog.socloze.com
use_backend be-blog if acl_blog
backend be-blog
option forwardfor
http-request add-header X-Forwarded-Proto https
redirect scheme https code 301 if !{ ssl_fc }
server wordpress wordpress:1200 check ssl none resolvers docker init-addr libc,none
And the docker compose file too
version: '3.3'
services:
db:
image: mysql:5.7
environment:
MYSQL_DATABASE: wordpress
MYSQL_PASSWORD: Mypassword#
MYSQL_ROOT_PASSWORD: Mypassword#
MYSQL_USER: wordpress
volumes:
- db_data:/var/lib/mysql
networks:
- default
logging:
driver: json-file
wordpress:
image: wordpress:latest
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: Mypassword#
WORDPRESS_DB_USER: wordpress
ports:
- 1200:80
volumes:
- wordpress_files:/var/www/html
networks:
- haproxy-net
- default
logging:
driver: json-file
networks:
default:
driver: overlay
haproxy-net:
external: true
volumes:
db_data:
driver: local
driver_opts:
device: /data/mysql
o: bind
type: none
wordpress_files:
driver: local
driver_opts:
device: /data/wordpress
o: bind
type: none
BTW, I have switched to this, but it does not solve anything
server wordpress wordpress:1200 check resolvers docker init-addr libc,none