I am trying to use jwilder/nginx-proxy:latest
for proxy reverse.
Here is my docker-compose.yml
, it works for http, but failed fot https.
When access https://web.test.cn
, it return 500 error.
version: '3.9'
services:
test-proxy:
image: "jwilder/nginx-proxy:latest"
container_name: "test-proxy"
volumes:
- "html:/usr/share/nginx/html"
- "dhparam:/etc/nginx/dhparam"
- "vhost:/etc/nginx/vhost.d"
- "certs:/etc/nginx/certs"
- "/run/docker.sock:/tmp/docker.sock:ro"
restart: "always"
networks:
- "test-net"
ports:
- "80:80"
- "443:443"
test-certs:
image: "jrcs/letsencrypt-nginx-proxy-companion:latest"
container_name: "test-certs"
volumes:
- "html:/usr/share/nginx/html"
- "dhparam:/etc/nginx/dhparam"
- "vhost:/etc/nginx/vhost.d"
- "certs:/etc/nginx/certs"
- "/run/docker.sock:/var/run/docker.sock:ro"
environment:
NGINX_PROXY_CONTAINER: "test-proxy"
DEFAULT_EMAIL: "xx@hotmail.com"
restart: "always"
depends_on:
- "test-proxy"
networks:
- "test-net"
test-web:
container_name: 'test-web'
image: 'xx/test:web-v1.0.0'
ports:
- "8888:80"
- "8889:443"
environment:
- NODE_ENV=production
- VIRTUAL_HOST=web.test.cn
#volumes:
# - ./test-web/:/usr/share/nginx/html
networks:
- "test-net"
expose:
- "80"
- "443"
test-server:
container_name: 'test-server'
image: 'myhub/test:server-v1.0.0'
restart: always
working_dir: '/app'
ports:
- "8886:80"
- "8887:443"
volumes:
# - ./test-server/:/app
- ./test-certificates/https:/https/
environment:
- VIRTUAL_HOST=server.test.cn
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_Kestrel__Certificates__Default__Password=server
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/server.test.cn.pfx
entrypoint:
["dotnet", "test.Mango.Web.Host.dll"]
networks:
- "test-net"
depends_on:
- test-mysql
#- test-chrome
#test-chrome:
# container_name: 'test-chrome'
# image: 'selenium/standalone-chrome'
# shm_size: 200m
# restart: always
# ports:
# - "8886:4444"
test-mysql:
container_name: 'test-mysql'
image: 'mysql'
restart: always
environment:
MYSQL_DATABASE: 'MangoDb'
MYSQL_ROOT_PASSWORD: 'dbpassword'
MYSQL_USER: 'test'
MYSQL_PASSWORD: 'dbpassword'
ports:
- "8880:3306"
networks:
- "test-net"
volumes:
- ./test-mysql:/var/lib/mysql
volumes:
certs:
html:
vhost:
dhparam:
networks:
test-net:
external: true
I reference 500 Internal Server Error #689, and get the same nginx config below
# web.test.cn
upstream web.test.cn {
## Can be connected with "test-net" network
# test-web
server 172.19.0.3:80;
}
server {
server_name web.test.cn;
listen 80 ;
access_log /var/log/nginx/access.log vhost;
include /etc/nginx/vhost.d/default;
location / {
proxy_pass http://web.test.cn;
}
}
server {
server_name web.test.cn;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log vhost;
return 500;
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
}
But, not sure how to resolve it.