标签:type tool png stat response content int end creates
nginx是最好的反向代理服务器。
Node.js是。。。 好吧 ,不介绍了,猛击这里
现在小介绍下怎么用nginx和node.js配合使用。
先写个helloworld.js
然后用node helloworld.js指令开启,这样跑在本地的机子的nodejs的程序就算开起来了,占用的是8000端口,可自己修改。
接着,我们在nginx的vhost.conf里面写一个server
将网站域名设置好,然后端口设置为80,最后proxy_pass设置为http://127.0.0.1:8000,将所有从taqing.me:80的请求传递到nodejs程序去。
重启nginx
访问域名,就可以了看到helloworld了。
虽然node.js本身就可以做服务器是没错啦,比如welcome.js里面设置为80端口就可以了。
但是一个机子跑多个网站,其他网站又是用别的服务器,在80端口已经被占用的情况下,是可以用代理到别的端口来处理的。
nginx and node.js配合使用 helloworld
标签:type tool png stat response content int end creates
原文地址:http://www.cnblogs.com/niejunchan/p/6505421.html