-2

I have my meteor app running on my production server. I have a reverse proxy setup on a different server.

A curl from my reverse proxy server to my app server gives me a Connection Refused.

My app is running on port 8080 and my firewall allows access to the port. I suspect the reason for the connection refused is that my app is running on 127.0.0.1 instead of 0.0.0.0

On running sudo netstat -tapn I get a

tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 14391/node

How do I get the app to run on 0.0.0.0. If this is not the reason, what else could cause a connection refused?

nupac
  • 2,459
  • 7
  • 31
  • 56

1 Answers1

1

127.0.0.1 is the loopback IP it's usually the same as localhost (as defined in your hosts file). you should never be able to connect to that IP from the outside. 0.0.0.0 binds to all IPs on the server, which is accessible from the outside.

Jonathan Eustace
  • 2,469
  • 12
  • 31
  • 54
  • yes, and because my app is running on 127.0.0.1, my proxy server cannot access it. How do I get the meteor app be accessible? – nupac Jul 10 '16 at 06:53
  • Have it run on an accessible IP. – Jonathan Eustace Jul 10 '16 at 06:54
  • precisely my question, how do I run it on an accessible IP? For a node app, you can set the ip but how do I do it for a meteor app? – nupac Jul 10 '16 at 06:57
  • You could run your app on 127.0.0.1 while using NGINX to forward from an outside accessible IP to the loopback IP. Look at this link: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-meteor-js-application-on-ubuntu-14-04-with-nginx – Jonathan Eustace Jul 10 '16 at 07:00
  • Just to be clear you will need NGINX running on the same server as your app. – Jonathan Eustace Jul 10 '16 at 17:54