Port 80 already in use (EC2) #14

Open
opened 2019-11-06 17:39:35 +00:00 by Ghost · 3 comments

Hi,
I'm trying to setup a Greenlock project on an EC2 linux instance and I'm getting the error that the address 0.0.0.0:80 is already in use.

I ran the comands

npx greenlock init --maintainer-email 'myemail@dotcom' --manager-config-file ./greenlock.json
npx greenlock defaults --subscriber-email 'myemail@dotcom' --agree-to-terms
npx greenlock add --subject myDomain.tk --altnames myDomain.tk

and followed step by step the quick start until the command:

sudo setcap 'cap_net_bind_service=+ep' $(which node)

and when I try to run npm start or npm start -- --staging the following error apears:

'packageRoot' not defined, trying /home/ec2-user/my-project-folder

Error: listen EADDRINUSE: address already in use 0.0.0.0:80

EADDRINUSE: '0.0.0.0:80'

I think that maybe a have to run the greenlock service on another port but I'm not sure that's the right approach.

Could you help me or just point me on the right direction? thanks

Hi, I'm trying to setup a Greenlock project on an EC2 linux instance and I'm getting the error that the address 0.0.0.0:80 is already in use. I ran the comands ``` npx greenlock init --maintainer-email 'myemail@dotcom' --manager-config-file ./greenlock.json npx greenlock defaults --subscriber-email 'myemail@dotcom' --agree-to-terms npx greenlock add --subject myDomain.tk --altnames myDomain.tk ``` and followed step by step the quick start until the command: `sudo setcap 'cap_net_bind_service=+ep' $(which node)` and when I try to run `npm start` or `npm start -- --staging` the following error apears: >**'packageRoot' not defined, trying /home/ec2-user/my-project-folder** >**Error: listen EADDRINUSE: address already in use 0.0.0.0:80** >**EADDRINUSE: '0.0.0.0:80'** I think that maybe a have to run the greenlock service on another port but I'm not sure that's the right approach. Could you help me or just point me on the right direction? thanks
Owner

The instance probably has something running on port 80 - like Apache or whatnot.

EC2 is very complicated. It’s intended for seasoned DevOps with many years of AWS experience. And the instances can go down at any time.

I’d recommend starting out with something easy and reliable like Digital Ocean (or Vultr, OVH, or Scaleway).

Search for “lsof tcp port 80” and you’ll find the command you need to figure out what’s taking port 80.

I’m not at my computer right now to find it, but I’ll put it in the docs later.

The instance probably has something running on port 80 - like Apache or whatnot. EC2 is very complicated. It’s intended for seasoned DevOps with many years of AWS experience. And the instances can go down at any time. I’d recommend starting out with something easy and reliable like Digital Ocean (or Vultr, OVH, or Scaleway). Search for “lsof tcp port 80” and you’ll find the command you need to figure out what’s taking port 80. I’m not at my computer right now to find it, but I’ll put it in the docs later.
Author

Thanks for the reply. Apache was running on that port, I changed apache's port and got the Greenlock app to run but another error occur:

'packageRoot' not defined, trying /home/ec2-user/my-project-folder
Listening on 0.0.0.0:80 for ACME challenges, and redirecting to HTTPS
Listening on 0.0.0.0:443 for secure traffic
Ready to Serve:
         myDomain.tk
ACME Directory URL: https://acme-v02.api.letsencrypt.org/directory
set greenlockOptions.notify to override the default logger
Error cert_issue:
getaddrinfo EAI_AGAIN myDomain.tk
code: EAI_AGAIN
Error: getaddrinfo EAI_AGAIN myDomain.tk
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)

Sorry for the basic questions, I'm still new at this and didn't found any docs for trying to debug this error on my own (I think you are still developing it) but if there is something that I could look at can you tell me Where it's?

About the alternatives for EC2 I will look into it but for now I'm using AWS for its free tier

thanks

Thanks for the reply. Apache was running on that port, I changed apache's port and got the Greenlock app to run but another error occur: ```bash 'packageRoot' not defined, trying /home/ec2-user/my-project-folder Listening on 0.0.0.0:80 for ACME challenges, and redirecting to HTTPS Listening on 0.0.0.0:443 for secure traffic Ready to Serve: myDomain.tk ACME Directory URL: https://acme-v02.api.letsencrypt.org/directory set greenlockOptions.notify to override the default logger Error cert_issue: getaddrinfo EAI_AGAIN myDomain.tk code: EAI_AGAIN Error: getaddrinfo EAI_AGAIN myDomain.tk at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) ``` Sorry for the basic questions, I'm still new at this and didn't found any docs for trying to debug this error on my own (I think you are still developing it) but if there is something that I could look at can you tell me Where it's? About the alternatives for EC2 I will look into it but for now I'm using AWS for its free tier thanks
Owner

I didn't see your reply.

Error: getaddrinfo EAI_AGAIN myDomain.tk
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)

See https://stackoverflow.com/questions/40182121/error-getaddrinfo-eai-again

Your DNS isn't set up, or the EC2 has weird DNS / NAT rules that are causing DNS resolution to fail.

I didn't see your reply. ``` Error: getaddrinfo EAI_AGAIN myDomain.tk at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) ``` See https://stackoverflow.com/questions/40182121/error-getaddrinfo-eai-again Your DNS isn't set up, or the EC2 has weird DNS / NAT rules that are causing DNS resolution to fail.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: root/greenlock-express.js#14
No description provided.