Hi, I’m new to docker .
I work on a VM (Ubuntu 18) on my Win10 laptop.
On this VM I have 3 docker containers created with docker-compose.
The first docker-compose.yml (wordpress + sql)
version: '3.1'
services:
wordpress:
depends_on:
- mysql
image: wordpress
restart: always
ports:
- 8080:80
environment:
VIRTUAL_HOST: wordpressalex_wordpress_1.local
VIRTUAL_PORT: 8080
WORDPRESS_DB_PASSWORD: *
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: *
networks:
default:
external:
name: nginx-network
And the second for nginx in a different folder
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
default:
external:
name: nginx-network
I can access the wordpress container via http://[ip of the VM]:8080/
But when I hit http://[ip of the VM]/ I get a 503 Service Temporarily Unavailable from Nginx.
When I hit http://wordpressalex_wordpress_1.local/ (that I’ve added to my Windows 10 etc/hosts) I get this answer :
Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.
docker ps : all my containers are UP and running.
docker network inspect nginx-network : the 3 containers are in the network with an IP.
The nginx service is active but I get no logs (I’ve already changed the error_logs to debug in the nginx.conf)
In the Nginx docker container, the config has been auto made by jwilder/nginx-proxy :
...
upstream wordpressalex_wordpress_1.local {
server 172.18.0.4:80;
}
server {
server_name wordpressalex_wordpress_1.local;
listen 80;
...
location / {
proxy_pass http://wordpressalex_wordpress_1.local
}
}
How can I reverse-proxy my Wordpress container with Nginx ?
I’ve been on it for 2 days, I’ve made the process from scratch at least 5 times, with jwilder/nginx-proxy and with official nginx image and a Docker file, even with a non dockerized Nginx, I think I’m missing something
Thanks for reading me