acme-companion: Connection refused on 443
Hi all,
tried my best for the last two days and do not get the clue. Hopefully I haven’t made any basic mistakes which I should have identified myself, however, if you could provide me assistance I’d be thankful.
My desired setup is as follows:
- one nginx proxy serving for all services as reverse proxy
- letsencrypt support with this project
- one separate container for each service
My current design approach is to have separated docker compose files. The first defines the first two requirements and for each container from 3) there will be a separate compose file.
My compose file for nginx and nginx-companion looks like this:
version: '2'
services:
proxy:
image: jwilder/nginx-proxy:alpine
container_name: proxy
ports:
- "80:80"
- "443:443"
environment:
DEFAULT_HOST: domain.com
DOCKER_HOST: unix:///tmp/docker.sock
volumes:
- certs:/etc/nginx/certs:ro
- vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
- /root/docker-setup/nginx-letsencrypt/sync.domain.com.conf:/etc/nginx/vhost.d/sync.domain.com
networks:
- nw
proxy-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: proxy-companion
environment:
- DEBUG=true
volumes:
- certs:/etc/nginx/certs
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes_from:
- proxy
networks:
- nw
volumes:
certs:
vhost.d:
html:
networks:
nw:
I added an additional configuration file to overcome Issue #254 from jwilder’s project, i.e. I want to have multiple containers running on one subdomain.
The content of the additional file is very simple:
location /owncloud/ {
proxy_pass http://sync.domain.com/owncloud/;
}
Which finally leads to the compose file of 3) which is owncloud:
version: '2'
services:
mariadb:
image: mariadb:latest
container_name: owncloud-mariadb
environment:
- MYSQL_ROOT_PASSWORD_FILE=/tmp/initpw/mariadbpw-root
- MYSQL_DATABASE=ocdb
- MYSQL_USER=ocuser
- MYSQL_PASSWORD_FILE=/tmp/initpw/mariadbpw-ocuser
volumes:
- /root/docker-setup/owncloud/:/tmp/initpw/
- volume-owncloud-mariadb:/var/lib/mysql
- /root/docker-setup/owncloud/init-data:/docker-entrypoint-initdb.d/
networks:
nw_owncloud:
owncloud:
image: owncloud:9.1
container_name: owncloud
environment:
- VIRTUAL_HOST=sync.domain.com
# - VIRTUAL_PATH="/owncloud/"
- VIRTUAL_PORT=80
- LETSENCRYPT_HOST=sync.domain.com
- LETSENCRYPT_EMAIL=webmaster@domain.com
- LETSENCRYPT_TEST=true
# ports:
# - 8180:80
expose:
- 80
volumes:
- /ocdata:/var/www/html
networks:
nw_owncloud:
volumes:
volume-owncloud-mariadb:
# external: true
networks:
nw_owncloud:
# external: true
Here comes the issue. The owncloud container with http and the ip works well so I can assume that this setup is working. When it comes to nginx and nginx-companion I don’t even get log messages from nginx-proxy.
Example:
curl -v --ipv4 -I https://sync.domain.com/owncloud
* Trying XXX.XXX.141.136...
* connect to XXX.XXX.141.136 port 443 failed: Verbindungsaufbau abgelehnt
* Failed to connect to sync.domain.com port 443: Verbindungsaufbau abgelehnt
* Closing connection 0
curl: (7) Failed to connect to sync.domain.com port 443: Verbindungsaufbau abgelehnt`
(translated: connection refused).
What I tried/verified
- the certificates are there
- iptables do not seem to me as if there was something wrong
- curl with normal http works and I’m getting logs
- issue317 from jwilders did not work either, I even tried to “compose” the containers on the command line.
Do you please have any hint I can follow? Any help would be appreciated!
Kind regards, Martin
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (5 by maintainers)
Thanks @buchdag. I went back and reread that. I noticed my hello world was missing the
LETSENCRYPT_EMAIL
variable.FWIW, this is the hello world example I wish I had seen a long time ago, it might help out some other folks who come from where I’m coming from.
👋 Hi @grebois, I’m having a very similar problem, and don’t have any firewalls in place that would be causing problems.
When I do this, I notice nginx isn’t wired up to 443. Could that be the problem?
I’m using the
nginx.tmpl
from https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion#separate-containers-recommended-method, specifically https://github.com/jwilder/nginx-proxy/blob/a6e8fae7f5959d1f7a4751f495d876ed174b612f/nginx.tmpl.Update: After running
docker exec -it 99f0daf50d9b ls -l /etc/nginx/certs
, and saw that none existed, I realized that I had butchered the-v
command ofdocker run
. Recreating the containers fixed the problem for me 🎉 .Hi,
thanks for your input.
This seems about right. I should’ve mentioned that I also checked this. However, haven’t checked for nmap.
From my PC nmap returns:
And this really bothers me now. How can that be?
Also:
…which makes sense to me, because
Any ideas? What am I missing?
Thanks you all again in advance!
Kind regards, Martin
Are you certain your host is actually listening on port 443 and if yes that it is reachable from outside on this port ? Try
netstat -lt
for the former andnmap XXX.XXX.141.136
for the latter.