Linux环境下的Nodejs

最近在学习Node.js,在window下总是觉得不那么爽快。最简单而且环保的方法是在虚拟机中安装一个Linux。

1.Linux:家中的Linux为Centos。

2.VirtuallyBox: 开启2块网卡。第一个选Host-Only目的是为了让虚拟机通上网。第二块选Bridge Adapter,这是为了跟本地主机同一个网段。

3.关闭本地和虚拟机的防火墙。

4.Linux中的Nodejs监听的IP要注意。如果是127.0.0.1本地是无法访问。

相关资料:

查看iptables状态:

service iptables status

iptables开机自动启动:

开启: chkconfig iptables on

关闭: chkconfig iptables off

iptables关闭服务:

开启: service iptables start

关闭: service iptables stop