I am using the https://github.com/jwilder/nginx-proxy for nginx-proxy setting
The port 80 redirect is working. That means i can get to my site via non SSL using test.example.com but with HTTPS i get a chrome error of "This webpage is not available ERR_CONNECTION_CLOSED"
Then I found that default.conf from nginx-proxy seems doesn't listen 443 port:
upstream docker-reverse-proxy.com {
## Can be connected with "test" network
# test_nginx_1
server 172.19.0.3:443;
}
server {
server_name docker-reverse-proxy.com;
listen 80 ;
access_log /var/log/nginx/access.log vhost;
location / {
proxy_pass https://docker-reverse-proxy.com;
}
}
Below is my configuation:
1) docker run -d -p 80:80 -p 443:443 -v /private/etc/ssl/certs:/etc/nginx/certs -v /var/run/docker.sock:/tmp/docker.sock:ro --name nginx-proxy --net=test jwilder/nginx-proxy:alpine
2)docker-compose.yml
version: '3'
services:
php-fpm:
build: .
restart: always
volumes:
- web:/www
networks:
- backend
nginx:
image: nginx:alpine
restart: always
environment:
- VIRTUAL_HOST=docker-reverse-proxy.com
- VIRTUAL_PROTO=https
- VIRTUAL_PORT=443
ports:
- 80
- 443
volumes:
- web:/www:ro
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- /private/etc/ssl/certs:/etc/nginx/certs
networks:
- frontend
- backend
depends_on:
- php-fpm
volumes:
web:
networks:
backend:
frontend:
external:
name: test