I am having problems getting the wordpress docker image working with the nginx docker image.
The python/django container works perfectly fine with nginx, but the wordpress/apache one is having problems. I can get to the django site, with https. I cannot get into the wordpress one with https. In fact, when I go to my site site.com/wp, I get back site.com:8080/wp, so for some reason it is coming back through port 8080, and not 443 or 80. I've tried setting the wordpress site as the root location / (in the default.conf file) and it still has the same problem (then I get site.com:8080). The wordpress functionality is normal, I can edit the site as usual.
default.conf file for nginx
disable_symlinks off;
ssl_certificate xxx
ssl_certificate_key xxx
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name site.com;
location / {
proxy_pass http://django:8000; #django container
}
location /static {
alias /path/to/static;
}
location /wp {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://wordpress:80; #the wordpress container
}
}
docker yml
version: '3.7'
services:
django:
restart: always
build:
context: .
dockerfile: docker-django #django gunicorn server, python image
ports:
- "8000:8000"
wordpress:
restart: always
build:
context: .
dockerfile: docker-wordpress #docker wordpress-apache image
# image: wordpress:latest
volumes:
- ./www/html:/var/www/html
- ./etc/apache2:/etc/apache2
ports:
- "8080:80"
nginx:
restart: always
build:
context: .
dockerfile: docker-nginx #docker nginx image
# image: nginx
volumes:
- ./xx/static:/usr/xx/static
- ./nginx/conf.d:/etc/nginx/conf.d
ports:
- "443:443"
- "80:80"
depends_on:
- django
- wordpress
question from:
https://stackoverflow.com/questions/66056395/docker-wordpress-apache-behind-docker-nginx-port-number-issue 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…