1

I'm setting up my AWS EC2 instance. I wanted to let that instance access via https but I get a

This is what I tried

run docker pull abiosoft/caddy

Put Caddyfile in home folder

Run mkdir -p $HOME/caddycerts; chmod ugo+rwx $HOME/caddycerts;

Run docker run -d -e "CADDYPATH=/etc/caddycerts" -v $HOME/Caddyfile:/etc/Caddyfile -v $HOME/caddycerts:/etc/caddycerts -p 443:443 abiosoft/caddy

Run docker restart *dockerName*

My Caddyfile looks like this:

some-domain-name.com {
    tls myemail
    proxy / 172.17.0.1:9001 {
        header_upstream Host {host}
        header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-Proto {scheme}
    }
}

Error: curl: (7) Failed to connect to some-domain-name.com port 443: Connection refused

EC2 instance's security group has https enabled for port 443

Siddharthan Asokan
  • 4,321
  • 11
  • 44
  • 80

3 Answers3

0

when you use AWS make sure that the port you are using is allowed and you have the right to use it

bessam Sahli
  • 105
  • 7
0

AWS Security group and ACL doesn't give connection refused, they silently drops the packet. From the message connection refused it seems the service isn't running or server isn't listening on port 443. Have you tried to telnet it locally ? Does it work ?

telnet localhost 443

James Dean
  • 4,033
  • 1
  • 9
  • 18
0
Error: curl: (7) Failed to connect to some-domain-name.com port 443: Connection refused

The above error message means that your web server is not running on the specified port of 443. You can simply validate via a telnet (which I see in James's answer above).

From your caddyfile it points to port 9001. The first line of the Caddyfile is always the address of the site to serve.

Without seeing the dockerfile it's hard to pinpoint, but I'd say there's nothing configured to run on 443 in your application

Udara Jayawardana
  • 1,073
  • 2
  • 14
  • 27