Node development phase, generally used
http
Module to start a local server, easy to debug.
It's probably like this:
varrequire("http");var server = http.createServer();server.listen(8888);
So the question is, how do I deploy my application to the VPS? You can't use it http://10.88.77.66:8888
to access it? Yes, the title of the article is the solution.
My environment is roughly the same centos 6
lnmp一键部署
. As lnmp
for how to operate, I will not write. Google for yourself
Suppose my domain name is money.ivan.com
I want to proxy it to http://10.88.77.66:8888
, next modify the corresponding domain name nginx config file
upstream Nodejs {server 127.0 . 0 . 1 : 8888 ; #server 127.0 . 0 . 1 : 8888 ; KeepAlive ;} server {Listen ; server_name Money . Ivan . com Access_log/home/wwwlogs/money . Ivan . COM . log access; Location / {proxy_set_header X -real -ip $remote _addr ; Proxy_set_header X -forwarded -for $proxy _add_x_forwarded_for ; Proxy_set_header Host $http _host ; Proxy_set_header X -nginx -proxy true ; Proxy_set_header Connection "" ; Proxy_pass http: //nodejs; }}
Through the above modification, so that nginx reverse proxy to our site. can be money.ivan.com
accessed by visiting our application.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the Nginx reverse proxy deployment Nodejs, including the nodejs,nginx aspects of the content, I hope the PHP tutorial interested in a friend helpful.