Multiple hosts defined, second one does not get https config in /etc/nginx/conf.d/default.conf
See original GitHub issueI have defined a second domain name in the Docker VIRTUAL_HOST env variable and I am not getting https for it.
When I check the /etc/nginx/conf.d/default.conf
file I see the config
# paste.xxx.dev
upstream paste.xxx.dev {
## Can be connected with "docker_debian03_net" network
# privatebin
server 172.16.241.3:8080;
}
server {
server_name paste.xxx.dev;
listen 80 ;
access_log /var/log/nginx/access.log vhost;
location / {
proxy_pass http://paste.xxx.dev;
}
}
# paste.xxx.yyy.dev
upstream paste.xxxyyy.dev {
## Can be connected with "docker_debian03_net" network
# privatebin
server 172.16.241.3:8080;
}
server {
server_name paste.xxx.yyy.dev;
listen 80 ;
access_log /var/log/nginx/access.log vhost;
# Do not HTTPS redirect Let'sEncrypt ACME challenge
location ^~ /.well-known/acme-challenge/ {
auth_basic off;
auth_request off;
allow all;
root /usr/share/nginx/html;
try_files $uri =404;
break;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
server_name paste.xxx.yyy.dev;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log vhost;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_certificate /etc/nginx/certs/xxx.dev.crt;
ssl_certificate_key /etc/nginx/certs/xxx.dev.key;
add_header Strict-Transport-Security "max-age=31536000" always;
location / {
proxy_pass http://paste.xxx.yyy.dev;
}
}
docker-compose.yml
version: "3.9"
services:
privatebin:
container_name: privatebin
image: privatebin/fs
volumes:
- /data/docker/privatebin/data:/srv/data
environment:
- TZ=Australia/Sydney
- PHP_TZ=Australia/Sydney
- VIRTUAL_HOST=paste.xxx.yyy.dev,paste.xxx.dev
- VIRTUAL_PORT=8080
networks:
- debian03_net
#ports:
#- 8080:8080
restart: unless-stopped
nginx-proxy:
container_name: nginx-proxy
image: jwilder/nginx-proxy
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /data/docker/certs:/etc/nginx/certs
networks:
- debian03_net
restart: unless-stopped
networks:
debian03_net:
ipam:
driver: default
config:
- subnet: 172.16.241.0/24
This line is causing the issue:
- VIRTUAL_HOST=paste.xxx.yyy.dev,paste.xxx.dev
The paste.xxx.dev
only gets a port 80 definition and no port 443 config.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Docker Nginx stopped: [emerg] 1#1: host not found in upstream
I have many servers in the config file, even if one server was down, I need to have running nginx. Is there any...
Read more >Installing an SSL certificate on Nginx - Hosting - Namecheap
To install the SSL certificate on Nginx, you need to show the server which files to use, either by a) creating a new...
Read more >Understanding the Nginx Configuration File Structure and ...
Nginx is one of the most popular web servers in the world, ... contexts can be layered within one another, Nginx allows configurations...
Read more >How to Configure NGINX | Linode
This guide shows you several different NGINX server configurations. NGINX Config: Directives, Blocks, and Contexts. All NGINX configuration ...
Read more >NGINX Configuration Guide: How to Get Started - Plesk
conf or etc/nginx/sites-enabled/default. No matter the installation source, though, server configuration files feature one or more server blocks ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ilium007 @Pearseak Guys I fixed this issue after updating the docker-composer.yaml version to version: ‘2’. previously I used 3.9
yeah that’s correct