Posted in Nodejs

Nodejs | Operate web server whenever power on

Add below lines to ‘/etc/rc.local’

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

node /home/ubuntu/landing_page/landing_page.js

 

External mobule is also available like ‘forever’ for setting┬áthe server to execute nodejs script whenever the machine is on.