Which is the best method (in terms of speed / best practices) for hosting a Node/Express app on an EC2 server instance running Ubuntu?

  1. Use Nginx as a proxy as outlined in this question.
  2. Add a port forwarding rule in iptables, e.g https://gist.github.com/776580.

Can anyone outline any problems with either method, it just seems a bit pointless using Nginx when all I'm doing is forwarding requests from port 80 to 8000.


The advantage of using nginx is that it is easier to manage multiple domains as well as caching of static files.

  • 1
    I agree. Right now, it's "just" forwarding from 80 to 8000. But what are you going to do if/when you have another webapp on 8001? You can't forward a port to both at the same time. However, if you're using Nginx then it's just another virtual host setup and anything for test.example.com goes to 8000, live.example.com to 8001, in very little time.
    – gac
    May 28 '12 at 14:33
  • Good points, I'm now using Nginx as a proxy. Port forwarding using iptables would work for one app but as you say it's much more manageable using Nginx were I to host multiple apps.
    – StuR
    May 29 '12 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.