I have an Ubuntu server 20.04
I have nginx installed on that server (nginx is not dockerized)
There are many docker apps running which nginx is proxying for fine.
I am trying to run Wordpress in a docker container using the official Wordpress image and point my domain to nginx which uses proxy_pass to point it to Wordpress container.
When I spin up my docker container, I can access it fine via the IP address but when I try to access it via my domain, I get a redirect loop.
Here is my setup:
DNS Records
A - @ - X.X.X.X
A - www - X.X.X.X
nginx config
server {
server_name domain.io www.domain.io;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.domain.io/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.domain.io/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass http://127.0.0.1:1234;
}
}
server {
if ($host = domain.io) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = www.domain.io) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name domain.io www.domain.io;
return 404; # managed by Certbot
}
docker-compose.yml
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
ports:
- 1234:80
environment:
WORDPRESS_DB_HOST:
WORDPRESS_DB_USER:
WORDPRESS_DB_PASSWORD:
WORDPRESS_DB_NAME:
volumes:
- wordpress:/var/www/html
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE:
MYSQL_USER:
MYSQL_PASSWORD:
MYSQL_RANDOM_ROOT_PASSWORD:
volumes:
- db:/var/lib/mysql
volumes:
wordpress:
db:
The error I'm getting:

I have an Ubuntu server 20.04
I have nginx installed on that server (nginx is not dockerized)
There are many docker apps running which nginx is proxying for fine.
I am trying to run Wordpress in a docker container using the official Wordpress image and point my domain to nginx which uses proxy_pass to point it to Wordpress container.
When I spin up my docker container, I can access it fine via the IP address but when I try to access it via my domain, I get a redirect loop.
Here is my setup:
DNS Records
nginx config
docker-compose.yml
The error I'm getting:
