-1

I´m using centOS and I want to redirect port xxxx to anthor port.

node.js is installed. I have tried it with this note: Best practices when running Node.js with port 80 (Ubuntu / Linode)

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000

I get an error-message: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

If there is another way to redirecting ports just let me know please.

Joe
  • 38,368
  • 16
  • 103
  • 119
kornholio
  • 23
  • 4

1 Answers1

0

You will probably want to use Nginx as a reverse-proxy. Check out DigitalOcean's excellent tutorial for setting up Node.js in production, which shows how to use Nginx in the way you're trying to achieve. I.e.:

location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
Niels de Bruin
  • 659
  • 5
  • 15