I've built a node.js-express app. By default it is listening on port 3000. I have the system hosted on an EC2 instance and have pointed a domain's A record to the AWS elastic IP address.
I'd like for HTTP requests to the domain name to automatically be directed to port:3000 or I'd like to be able to start the Express HTTP server up on port 80. (I tried starting up the node http server on port 80 but got an error)
I can access the node app if I type www.myurl.com:3000 but I need to be able to drop that requirement for the good of the end users.
Does anyone know how to make node and ports and domains all play nicely together on my amazon-buntu server?
I found this article helpful when I had that same problem:
http://www.debian-administration.org/articles/386
I ended up using authbind -- once configured you just do:
authbind node myscript
In my deployment script, I usually just run this to ensure TCP traffic on port 80 goes to 3000:
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With