How to start node.js on port 80 on a linux server?

后端 未结 5 1496
暖寄归人
暖寄归人 2021-01-03 04:47

When I try to start node on port 80, the error tells me that the port is in use. I imagine that\'s Apache.

What is the proper way to \"take over\" port 80, and keep

5条回答
  •  情书的邮戳
    2021-01-03 05:35

    you can use ip tables to map port 80 to 8000

    iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8000
    

    to make it permanent

    sudo sh -c "iptables-save > /etc/iptables.rules"
    

    and add

    pre-up iptables-restore < /etc/iptables.rules
    

    to your /etc/network/interfaces

提交回复
热议问题