How do I safely run a Node.js server on port 80 with Amazon Elastic Beanstalk?
amazon-web-services, node.js
Solution
Beanstalk has a proxy build into it listening on port 80. Your Node.js app should only listen on `process.env.PORT`. Once it's done that, you'll be good to go.
Problem
The following error is common for people trying to run a Node.js server on port 80. ``` Error: listen EACCES 0.0.0.0:80 ``` I used to solve this on my Amazon EC2 server simply by using ``` sudo node app.js ``` Now I've learned not to use that method for security concerns. A good solution as explained in this answer is to use: ``` sudo apt-get install libcap2-bin sudo setcap cap_net_bind_service=+ep `readlink -f \`which node\`` ``` However I'm not sure how to implement either solution on an AWS Elastic Beanstalk instance, where I don't seem to have SSH access the way I did for the AWS EC2 server, and the only way I seem to have for running anything is in my `package.json` file like this: ``` { "scripts": { "start": "node init" } } ``` So I have no idea how I would run other types of commands. How is this done?