{"id":587,"date":"2013-01-09T14:59:45","date_gmt":"2013-01-09T06:59:45","guid":{"rendered":"http:\/\/xujiwei.com\/blog\/?p=587"},"modified":"2016-12-27T16:59:21","modified_gmt":"2016-12-27T08:59:21","slug":"build-private-nodejs-cloud-with-ukraine","status":"publish","type":"post","link":"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/","title":{"rendered":"\u4f7f\u7528 ukraine \u5efa\u8bbe node.js \u79c1\u6709\u4e91"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 ez-toc-wrap-right counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<p class=\"ez-toc-title\">\u6587\u7ae0\u76ee\u5f55<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69ee701686242\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69ee701686242\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E6%BA%90%E7%94%B1\" title=\"\u6e90\u7531\">\u6e90\u7531<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E6%AF%94%E8%BE%83\" title=\"\u6bd4\u8f83\">\u6bd4\u8f83<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E4%BF%AE%E6%94%B9\" title=\"\u4fee\u6539\">\u4fee\u6539<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E5%AE%89%E8%A3%85%E4%BF%AE%E6%94%B9%E5%90%8E%E7%9A%84_ukraine\" title=\"\u5b89\u88c5\u4fee\u6539\u540e\u7684 ukraine\">\u5b89\u88c5\u4fee\u6539\u540e\u7684 ukraine<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#1_%E5%AE%89%E8%A3%85_nodejs\" title=\"1. \u5b89\u88c5 node.js\">1. \u5b89\u88c5 node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#2_%E5%AE%89%E8%A3%85_forever\" title=\"2. \u5b89\u88c5 forever\">2. \u5b89\u88c5 forever<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#3_%E9%85%8D%E7%BD%AE_nodejs_%E7%94%A8%E6%88%B7\" title=\"3. \u914d\u7f6e nodejs \u7528\u6237\">3. \u914d\u7f6e nodejs \u7528\u6237<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#4_%E8%8E%B7%E5%8F%96%E5%B9%B6%E5%AE%89%E8%A3%85_ukraine\" title=\"4. \u83b7\u53d6\u5e76\u5b89\u88c5 ukraine\">4. \u83b7\u53d6\u5e76\u5b89\u88c5 ukraine<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#5_%E9%85%8D%E7%BD%AE_ukraine\" title=\"5. \u914d\u7f6e ukraine\">5. \u914d\u7f6e ukraine<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#6_%E5%AE%89%E8%A3%85%E6%9C%8D%E5%8A%A1%E8%84%9A%E6%9C%AC\" title=\"6. \u5b89\u88c5\u670d\u52a1\u811a\u672c\">6. \u5b89\u88c5\u670d\u52a1\u811a\u672c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#7_%E4%BD%BF%E7%94%A8_nginx_%E4%BD%9C%E4%B8%BA%E5%89%8D%E7%AB%AF%E6%9C%8D%E5%8A%A1\" title=\"7. \u4f7f\u7528 nginx \u4f5c\u4e3a\u524d\u7aef\u670d\u52a1\">7. \u4f7f\u7528 nginx \u4f5c\u4e3a\u524d\u7aef\u670d\u52a1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#8_%E5%90%AF%E5%8A%A8_ukraine\" title=\"8. \u542f\u52a8 ukraine\">8. \u542f\u52a8 ukraine<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#9_%E6%A3%80%E6%9F%A5_ukraine_%E6%98%AF%E5%90%A6%E6%AD%A3%E5%B8%B8%E8%BF%90%E8%A1%8C\" title=\"9. \u68c0\u67e5 ukraine \u662f\u5426\u6b63\u5e38\u8fd0\u884c\">9. \u68c0\u67e5 ukraine \u662f\u5426\u6b63\u5e38\u8fd0\u884c<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E9%83%A8%E7%BD%B2%E8%87%AA%E5%B7%B1%E7%9A%84_nodejs_%E5%BA%94%E7%94%A8\" title=\"\u90e8\u7f72\u81ea\u5df1\u7684 node.js \u5e94\u7528\">\u90e8\u7f72\u81ea\u5df1\u7684 node.js \u5e94\u7528<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E7%BB%99_nodejs_%E5%BA%94%E7%94%A8%E7%BB%91%E5%AE%9A%E8%87%AA%E5%AE%9A%E4%B9%89%E5%9F%9F%E5%90%8D\" title=\"\u7ed9 node.js \u5e94\u7528\u7ed1\u5b9a\u81ea\u5b9a\u4e49\u57df\u540d\">\u7ed9 node.js \u5e94\u7528\u7ed1\u5b9a\u81ea\u5b9a\u4e49\u57df\u540d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9\" title=\"\u6ce8\u610f\u4e8b\u9879\">\u6ce8\u610f\u4e8b\u9879<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E9%97%AE%E9%A2%98%E5%8F%8A%E5%8F%8D%E9%A6%88\" title=\"\u95ee\u9898\u53ca\u53cd\u9988\">\u95ee\u9898\u53ca\u53cd\u9988<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E8%81%94%E7%B3%BB%E6%88%91\" title=\"\u8054\u7cfb\u6211\">\u8054\u7cfb\u6211<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E6%84%9F%E8%B0%A2\" title=\"\u611f\u8c22\">\u611f\u8c22<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99\" title=\"\u53c2\u8003\u8d44\u6599\">\u53c2\u8003\u8d44\u6599<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E6%BA%90%E7%94%B1\"><\/span>\u6e90\u7531<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"http:\/\/nodejs.org\/\">node.js<\/a> \u8d8a\u6765\u8d8a\u6d41\u884c\uff0c\u6258\u7ba1 node.js \u5e94\u7528\u7684\u4e91\u670d\u52a1\u4e5f\u8d8a\u6765\u8d8a\u591a\uff0c\u4f8b\u5982 <a href=\"http:\/\/nodejitsu.com\/\">nodejitsu<\/a>\u3001<a href=\"http:\/\/www.heroku.com\/\">heroku<\/a> \u7b49\u3002<\/p>\n<p>\u4f46\u662f\u8fd9\u4e9b\u4e91\u670d\u52a1\u901a\u5e38\u6709\u8fd9\u6837\u90a3\u6837\u7684\u9650\u5236\uff0c\u53c8\u6216\u8005\u662f\u8981\u6536\u8d39\u7684\u3002\u800c\u6709\u4e9b\u65f6\u5019\u6211\u901a\u5e38\u4e0d\u9700\u8981\u8dd1\u5f88\u5927\u7684\u5e94\u7528\uff0c\u6216\u8005\u662f\u5f88\u7a33\u5b9a\u7684\u5e94\u7528\uff0c\u53ea\u662f\u4e3a\u4e86\u8dd1\u4e00\u4e9b\u5c0f\u7684\uff0c\u6216\u8005\u662f\u5b66\u4e60\u7528\u7684 node.js \u5e94\u7528\uff0c\u5e76\u4e14\u6211\u4e5f\u6709\u81ea\u5df1\u7684 VPS\uff0c\u60f3\u628a\u8fd9\u4e9b\u5e94\u7528\u6258\u7ba1\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n<p>\u4e8e\u662f\u6211\u9700\u8981\u53bb\u627e\u4e00\u4e2a\u53ef\u4ee5\u5728\u81ea\u5df1\u7684 VPS \u4e0a\u5efa\u8bbe\u4e00\u4e2a node.js \u79c1\u6709\u4e91\u7684\u8f6f\u4ef6\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%AF%94%E8%BE%83\"><\/span>\u6bd4\u8f83<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5728\u770b\u4e86 <https: \/\/github.com\/joyent\/node\/wiki\/Node-Hosting> \u4e2d\u7684 DIY Platforms \u540e\uff0c\u5c1d\u8bd5\u4e86\u4e00\u4e0b\u5176\u4e2d\u4ecb\u7ecd\u7684\u5e73\u53f0\uff1a<\/p>\n<ul>\n<li><strong>nodester<\/strong>: \u5b89\u88c5\u6bd4\u8f83\u9ebb\u70e6\uff0c\u4e0d\u652f\u6301\u65b0\u7248\u672c\u7684 nodejs\uff0c\u5b89\u88c5\u8bf4\u660e\u8fd8\u662f\u9488\u5bf9 node 0.4.11 \u7684<\/li>\n<li><strong>CloudFoundry<\/strong>: \u6bd4\u8f83\u5e9e\u5927\uff0c\u800c\u4e14\u662f\u4ee5 vm \u65b9\u5f0f\u5b89\u88c5\uff0c\u4e0d\u9002\u5408 VPS<\/li>\n<li><strong>OpenShift<\/strong>: \u540c CloudFoundry\uff0c\u4e0d\u53ea\u652f\u6301 node.js\uff0c\u5b89\u88c5\u590d\u6742\uff0c\u4e0d\u9002\u5408 VPS<\/li>\n<li><strong>Nodejitsu<\/strong>: Nodejitsu \u5f00\u6e90\u4e86\u4ed6\u4eec\u6240\u7528\u7684 node.js \u5e94\u7528\u7ba1\u7406\u9879\u76ee haibu\uff0chaibu \u5b89\u88c5\u6bd4\u8f83\u7b80\u5355\uff0c\u800c\u4e14\u652f\u6301\u6700\u65b0\u7684 nodejs 0.8.16\uff0c\u4e0d\u8fc7 Nodejitsu  \u540c\u6837\u5f00\u6e90\u7684\u547d\u4ee4\u884c\u5ba2\u6237\u7aef jitsu \u5e76\u4e0d\u652f\u6301 haibu<\/li>\n<li><strong>Stagecoach<\/strong>: \u6587\u6863\u4e0d\u591f\u6e05\u6670\uff0c\u770b\u4e86\u5f88\u4e45\u4e5f\u6ca1\u660e\u767d\u5b83\u7684\u67b6\u6784\u548c\u600e\u4e48\u90e8\u7f72\u22ef\u22ef<\/li>\n<\/ul>\n<p>\u8fd9\u6837\u770b\u6765\u4f3c\u4e4e\u6ca1\u6709\u4e00\u4e2a\u53ef\u4ee5\u6ee1\u8db3\u6211\u7684\u9700\u8981\uff0c\u4e0d\u8fc7 GitHub \u662f\u5f3a\u5927\u7684\uff0c\u901a\u8fc7\u641c\u7d22\u627e\u5230\u4e86 <a href=\"https:\/\/github.com\/radekstepan\/ukraine\">ukraine<\/a> \u8fd9\u4e2a\u9879\u76ee\uff1a<\/p>\n<blockquote><p>\n  ukraine glues haibu and node-http-proxy adding a little helper, chernobyl, that deploys into this cloud. It is probably as stable as you think it is.\n<\/p><\/blockquote>\n<p>\u8fd9\u5c31\u662f\u6211\u60f3\u8981\u7684\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E4%BF%AE%E6%94%B9\"><\/span>\u4fee\u6539<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u539f\u59cb\u7684 ukraine \u867d\u7136\u5df2\u7ecf\u57fa\u672c\u6ee1\u8db3\u4e86\u6211\u7684\u9700\u8981\uff0c\u4f46\u662f\u8fd8\u6709\u4e00\u4e9b\u5c0f\u7684\u529f\u80fd\u9700\u8981\u589e\u52a0\uff1a<\/p>\n<ol>\n<li>\u4f7f\u7528 nginx \u4f5c\u4e3a\u524d\u7aef\uff0c\u8fd9\u6837 node.js \u5e94\u7528\u53ef\u4ee5\u90e8\u7f72\u5728 nginx \u540e\u9762\uff0c\u4e0e PHP \u7b49\u9879\u76ee\u5e76\u5b58<\/li>\n<li>\u4f7f\u7528 SSL \u4fdd\u62a4 haibu \u7684\u670d\u52a1\u7aef\uff0c\u9632\u6b62 auth_token \u56e0\u4e3a\u4e0d\u52a0\u5bc6\u7684 HTTP \u901a\u4fe1\u800c\u6cc4\u6f0f<\/li>\n<li>\u56e0\u4e3a\u4f7f\u7528 nginx \u4f5c\u4e3a\u524d\u7aef\uff0c\u6240\u4ee5 haibu \u670d\u52a1\u7aef\u548c node-http-proxy \u90fd\u4e0d\u9700\u8981\u76d1\u542c 0.0.0.0\uff0c\u800c\u53ea\u9700\u8981\u76d1\u542c 127.0.0.1<\/li>\n<li>\u9632\u6b62 node.js \u5e94\u7528\u76d1\u542c\u4e86\u5e38\u7528\u7aef\u53e3\u800c\u5bfc\u81f4\u5176\u4ed6\u5e94\u7528\u542f\u52a8\u5931\u8d25\uff0c\u56e0\u4e3a\u4f7f\u7528\u4e86 nginx \u4f5c\u4e3a\u524d\u7aef\uff0cnode.js \u5e94\u7528\u672c\u8eab\u76d1\u542c\u4e86\u4ec0\u4e48\u7aef\u53e3\u5c31\u4e0d\u91cd\u8981\u4e86<\/li>\n<li>\u9632\u6b62 node.js \u5e94\u7528\u76f4\u63a5\u5bf9\u5916\u63d0\u4f9b\u670d\u52a1\uff0c\u540c\u6837\u56e0\u4e3a\u5df2\u7ecf\u6709 nginx\uff0cnode.js \u5e94\u7528\u53ea\u9700\u8981\u76d1\u542c 127.0.0.1 \u5c31\u884c\u4e86<\/li>\n<li>chernobyl \u4e0d\u652f\u6301\u914d\u7f6e\u6bcf\u4e2a\u4e0d\u540c\u7684 ukraine \u76d1\u542c\u5728\u54ea\u4e2a\u7aef\u53e3\uff0c\u4ee5\u53ca\u6709\u6ca1\u6709\u914d\u7f6e SSL<\/li>\n<li>\u6211\u60f3 ukraine \u4f5c\u4e3a\u4e00\u4e2a\u670d\u52a1\u5b58\u5728\uff0c\u8fd9\u6837\u5728 VPS \u542f\u52a8\u65f6\u53ef\u4ee5\u81ea\u52a8\u542f\u52a8<\/li>\n<li>node.js \u5e94\u7528\u9700\u8981\u652f\u6301\u7ed1\u5b9a\u81ea\u5b9a\u4e49\u57df\u540d\uff0c\u800c\u4e0d\u662f\u53ea\u80fd\u7ed1\u5b9a\u5b50\u57df\u540d<\/li>\n<\/ol>\n<p>\u6240\u4ee5\u6211 fork \u4e86 radekstepan \u7684 ukraine \u5230 <\/https:><https: \/\/github.com\/ohdarling\/ukraine>\uff0c\u5e76\u505a\u4e86\u4e00\u4e9b\u81ea\u5df1\u9700\u8981\u7684\u4fee\u6539\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E5%AE%89%E8%A3%85%E4%BF%AE%E6%94%B9%E5%90%8E%E7%9A%84_ukraine\"><\/span>\u5b89\u88c5\u4fee\u6539\u540e\u7684 ukraine<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5982\u679c\u4f60\u548c\u6211\u4e00\u6837\uff0c\u4e5f\u9700\u8981\u4e00\u4e2a\u8fd9\u6837\u7b80\u5355\u7684 node.js \u79c1\u4e91\uff0c\u90a3\u4e48\u4ee5\u4e0b\u7684\u5185\u5bb9\u53ef\u4ee5\u5e2e\u52a9\u91cc\u90e8\u7f72 ukraine \u5230\u81ea\u5df1\u7684 VPS \u4e0a\u3002<\/p>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u5b89\u88c5\u6559\u7a0b\u4ee5\u5728 Ubuntu\/Debian \u4e0a\u4e3a\u4f8b\uff0c\u5e76\u4e14\u6240\u6709\u547d\u4ee4\u662f\u4ee5 root \u7528\u6237\u6267\u884c\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"1_%E5%AE%89%E8%A3%85_nodejs\"><\/span>1. \u5b89\u88c5 node.js<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>haibu \u9700\u8981 node.js \u7684\u7248\u672c\u5927\u4e8e 0.8\uff0c\u6240\u4ee5\u9700\u8981\u5b89\u88c5\u6700\u65b0\u7684 node.js \u5305\uff0c\u6216\u8005\u81ea\u884c\u7f16\u8bd1\u5b89\u88c5\u3002<\/p>\n<p>\u53c2\u8003\u8fd9\u7bc7\u6587\u7ae0\uff1a<a href=\"https:\/\/github.com\/joyent\/node\/wiki\/Installing-Node.js-via-package-manager\">Installing Node.js via package manager<\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_%E5%AE%89%E8%A3%85_forever\"><\/span>2. \u5b89\u88c5 forever<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>forever \u662f\u7528\u6765\u7ef4\u6301 ukraine \u4e00\u76f4\u5728\u542f\u52a8\u72b6\u6001<\/p>\n<pre><code>npm install forever -g\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"3_%E9%85%8D%E7%BD%AE_nodejs_%E7%94%A8%E6%88%B7\"><\/span>3. \u914d\u7f6e nodejs \u7528\u6237<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u4e3a\u4e86\u4f7f\u6240\u6709 node.js \u5e94\u7528\u4e0d\u4f7f\u7528 root \u6743\u9650\u8fd0\u884c\uff0c\u9632\u6b62\u51fa\u73b0\u6743\u9650\u65b9\u4fbf\u7684\u98ce\u9669\uff0c\u9700\u8981\u6dfb\u52a0\u4e00\u4e2a\u7528\u6237 <code>nodejs<\/code> \u6765\u8fd0\u884c node.js \u5e94\u7528\u3002<\/p>\n<pre><code>groupadd nodejs\nuseradd -g nodejs -m -s \/bin\/bash nodejs\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"4_%E8%8E%B7%E5%8F%96%E5%B9%B6%E5%AE%89%E8%A3%85_ukraine\"><\/span>4. \u83b7\u53d6\u5e76\u5b89\u88c5 ukraine<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u4e3a\u4e86\u7ba1\u7406\u65b9\u4fbf\uff0c\u8fd9\u91cc\u5b89\u88c5 ukraine \u5230 \/srv\/ukraine \u4e2d\uff0c\u5982\u679c\u4f60\u4e0d\u5b89\u88c5\u5728\u8fd9\u4e2a\u4f4d\u7f6e\uff0c\u90a3\u4e48\u76f8\u5173\u7684\u811a\u672c\u548c\u914d\u7f6e\u6587\u4ef6\u90fd\u9700\u8981\u4fee\u6539\u3002<\/p>\n<pre><code>cd \/srv\ngit clone https:\/\/github.com\/ohdarling\/ukraine\ncd ukraine\ngit checkout private-cloud\nnpm install\nchown -R nodejs.nodejs \/srv\/ukraine\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"5_%E9%85%8D%E7%BD%AE_ukraine\"><\/span>5. \u914d\u7f6e ukraine<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code>cd \/srv\/ukraine\ncp config.example.json config.json\nvim config.json\n<\/code><\/pre>\n<p>\u4e3a\u4e86\u5b89\u5168\u8d77\u89c1\uff0c\u5efa\u8bae auth_token \u4e0d\u8981\u7559\u7a7a\u3002<\/p>\n<p><code>example.com<\/code> \u9700\u8981\u66ff\u6362\u4e3a\u4f60\u81ea\u5df1\u7684\u57df\u540d\uff0c\u8fd9\u6837\u4ee5\u540e\u90e8\u7f72\u4e86 node.js \u5e94\u7528\u65f6\uff0c\u4f1a\u81ea\u52a8\u5206\u914d\u4e00\u4e2a package-name.example.com \u7684\u5b50\u57df\u540d\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6_%E5%AE%89%E8%A3%85%E6%9C%8D%E5%8A%A1%E8%84%9A%E6%9C%AC\"><\/span>6. \u5b89\u88c5\u670d\u52a1\u811a\u672c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u8fd9\u4e2a\u811a\u672c\u53ea\u9002\u7528\u4e8e Ubuntu\/Debian\u3002<\/p>\n<pre><code>cd \/srv\/ukraine\ncp server\/init-script\/ukraine \/etc\/init.d\/\nchmod +x \/etc\/init.d\/ukraine\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"7_%E4%BD%BF%E7%94%A8_nginx_%E4%BD%9C%E4%B8%BA%E5%89%8D%E7%AB%AF%E6%9C%8D%E5%8A%A1\"><\/span>7. \u4f7f\u7528 nginx \u4f5c\u4e3a\u524d\u7aef\u670d\u52a1<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u4e3a\u4e86\u4f7f node.js \u5e94\u7528\u4e0e\u539f\u6709\u7684 PHP \u5171\u5b58\uff0c\u4f7f\u7528 nginx \u4f5c\u4e3a ukraine \u7684\u524d\u7aef\u670d\u52a1\u3002<\/p>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u90e8\u7f72 node.js \u5e94\u7528\u5230 ukraine \u9700\u8981 nginx \u542f\u7528 chunkin \u6a21\u5757\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b nginx \u5e76\u6ca1\u6709\u5b89\u88c5\u6b64\u6a21\u5757\uff0c\u53ef\u4ee5\u81ea\u884c\u7f16\u8bd1\u5b89\u88c5\uff08\u53c2\u8003 <http: \/\/wiki.nginx.org\/NginxHttpChunkinModule>\uff09\uff0c\u6216\u8005\u76f4\u63a5\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5 <code>nginx-extras<\/code>\uff0c\u8fd9\u4e2a\u5305\u4e2d\u5305\u542b\u7684 nginx \u5df2\u7ecf\u7f16\u8bd1\u4e86 chunkin \u6a21\u5757\u3002<\/p>\n<p>\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9\u5230 <code>\/etc\/nginx\/sites-available\/ukraine<\/code>\uff0c\u5e76\u4e14\u5728 <code>\/etc\/nginx\/sites-enabled\/<\/code> \u4e2d\u6dfb\u52a0\u4e00\u4e2a\u5230\u914d\u7f6e\u6587\u4ef6\u7684\u7b26\u53f7\u94fe\u63a5\u3002\u6ce8\u610f\uff0c\u9700\u8981\u66ff\u6362\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9\u4e2d\u7684 <code>haibu.example.com<\/code> \u548c <code>*.example.com<\/code> \u4e3a\u4f60\u81ea\u5df1\u7684\u57df\u540d\u3002<\/p>\n<pre><code>server {\n    listen   80;\n    server_name  haibu.example.com;\n\n    access_log  \/var\/log\/nginx\/localhost.access.log;\n\n    chunkin on;\n\n    error_page 411 = @my_411_error;\n        location @my_411_error {\n        chunkin_resume;\n    }\n\n    location \/ {\n        proxy_pass http:\/\/localhost:9002;\n        proxy_set_header  X-Real-IP  $remote_addr;\n    }\n}\n\nserver {\n    listen   80;\n    server_name  *.example.com;\n\n    access_log  \/var\/log\/nginx\/localhost.access.log;\n\n    location \/ {\n        proxy_pass http:\/\/localhost:8000;\n        proxy_set_header  X-Real-IP  $remote_addr;\n        proxy_set_header Host $host;\n    }\n}\n<\/code><\/pre>\n<p>\u5efa\u8bae\u5728 haibu.example.com \u8fd9\u4e2a\u7ad9\u70b9\u4e0a\u542f\u52a8 SSL \u6765\u4fdd\u62a4 auth_token\u3002<\/p>\n<p>\u6dfb\u52a0\u5b8c\u914d\u7f6e\u6587\u4ef6\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8ba9 nginx \u91cd\u65b0\u8f7d\u5165\u914d\u7f6e\uff1a<\/p>\n<pre><code>nginx -s reload\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"8_%E5%90%AF%E5%8A%A8_ukraine\"><\/span>8. \u542f\u52a8 ukraine<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code>service ukraine start\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"9_%E6%A3%80%E6%9F%A5_ukraine_%E6%98%AF%E5%90%A6%E6%AD%A3%E5%B8%B8%E8%BF%90%E8%A1%8C\"><\/span>9. \u68c0\u67e5 ukraine \u662f\u5426\u6b63\u5e38\u8fd0\u884c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8bbf\u95ee <code>http:\/\/haibu.example.com\/version<\/code>\uff0c\u5c06\u4f1a\u770b\u5230\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre><code>{\"version\":\"haibu 0.9.7\"}\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff0c\u5982\u679c\u5728\u4e4b\u524d\u5df2\u7ecf\u914d\u7f6e\u4e86 auth_token\uff0c\u5c06\u4f1a\u770b\u5230\uff1a<\/p>\n<pre><code>{\"message\":\"Wrong auth token\"}\n<\/code><\/pre>\n<p>\u8fd9\u8bf4\u660e ukraine \u5df2\u7ecf\u6b63\u5e38\u542f\u52a8\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E9%83%A8%E7%BD%B2%E8%87%AA%E5%B7%B1%E7%9A%84_nodejs_%E5%BA%94%E7%94%A8\"><\/span>\u90e8\u7f72\u81ea\u5df1\u7684 node.js \u5e94\u7528<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u9996\u5148\u9700\u8981\u5728\u672c\u5730\u5b89\u88c5 ukraine\uff1a<\/p>\n<pre><code>npm install -g git:\/\/github.com\/ohdarling\/ukraine\\#private-cloud\n<\/code><\/pre>\n<p>\u5982\u679c\u4e4b\u524d\u914d\u7f6e\u4e86 auth_token\uff1a<\/p>\n<pre><code>chernobyl config haibu.example.com auth_token=xxxx\n<\/code><\/pre>\n<p>\u5982\u679c\u4e4b\u524d\u914d\u7f6e\u4e86 SSL\uff1a<\/p>\n<pre><code>chernobyl config haibu.example.com https=true\nchernobyl config haibu.example.com haibu_port=443\n<\/code><\/pre>\n<p>\u73b0\u5728\u53ef\u4ee5\u90e8\u7f72 node.js \u5e94\u7528\u4e86\uff0c\u8fdb\u5165\u5230 node.js \u5e94\u7528\u7684\u6839\u76ee\u5f55\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>chernobyl deploy haibu.example.com .\n<\/code><\/pre>\n<p>\u8fd9\u5c31\u4f1a\u90e8\u7f72\u8fd9\u4e2a node.js \u5e94\u7528\u5230 haibu.example.com \u4e86\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E7%BB%99_nodejs_%E5%BA%94%E7%94%A8%E7%BB%91%E5%AE%9A%E8%87%AA%E5%AE%9A%E4%B9%89%E5%9F%9F%E5%90%8D\"><\/span>\u7ed9 node.js \u5e94\u7528\u7ed1\u5b9a\u81ea\u5b9a\u4e49\u57df\u540d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5728\u7ed9 node.js \u7ed1\u5b9a\u81ea\u5b9a\u4e49\u57df\u540d\uff0c\u53ea\u9700\u8981\u5728 <code>package.json<\/code> \u4e2d\u6dfb\u52a0 <code>domains<\/code> \u5c5e\u6027\u5373\u53ef\uff1a<\/p>\n<pre><code>{\n    \"name\": \"example-app\",\n    \"version\": \"0.0.2\",\n    \"domains\": [\n        \"custom-example.com\"\n    ]\n    \"dependencies\": {\n        \"express\": \"2.5.x\"\n    },\n    \"scripts\": {\n        \"start\": \"server.js\"\n    }\n}\n<\/code><\/pre>\n<p>\u540c\u6837\u9700\u8981\u4fee\u6539 nginx \u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u628a\u81ea\u5b9a\u4e49\u57df\u540d\u52a0\u5230 server_name \u4e2d\uff1a<\/p>\n<pre><code>server {\n    listen   80;\n    server_name  *.example.com, custom-example.com;\n\n    access_log  \/var\/log\/nginx\/localhost.access.log;\n\n    location \/ {\n        proxy_pass http:\/\/localhost:8000;\n        proxy_set_header  X-Real-IP  $remote_addr;\n        proxy_set_header Host $host;\n    }\n}\n<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9\"><\/span>\u6ce8\u610f\u4e8b\u9879<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>\u6240\u6709 node.js \u5e94\u7528\u4f1a\u76d1\u542c\u5728\u4e00\u4e2a\u968f\u673a\u7aef\u53e3\uff0c\u5e76\u4e14\u4f1a\u76d1\u542c\u5728 127.0.0.1\uff0c\u4e5f\u5c31\u610f\u5473\u7740\u5728\u5916\u90e8\u6ca1\u6709\u529e\u6cd5\u76f4\u63a5\u8bbf\u95ee\u8fd9\u4e2a\u5e94\u7528<\/li>\n<li>package.json \u4e2d scripts.start \u5c5e\u6027\uff0c\u4e0d\u9700\u8981\u5e26 node\uff0c\u53ea\u9700\u8981\u6307\u5b9a\u4ee5\u54ea\u4e2a\u811a\u672c\u542f\u52a8\u5373\u53ef\uff0c\u4f8b\u5982\u4ee5\u4e0b\u662f\u9519\u8bef\u7684\uff1a<\/li>\n<\/ol>\n<pre><code>    {\n        \"name\" : \"example-app\",\n        \"scripts\" : {\n            \"start\" : \"node server.js\"\n        }\n    }\n<\/code><\/pre>\n<ol>\n<li>\u5982\u679c\u9700\u8981 node.js \u9274\u5b9a\u7279\u5b9a\u7684\u7aef\u53e3\uff0c\u5e76\u80fd\u76f4\u63a5\u5bf9\u5916\u670d\u52a1\uff0c\u53ef\u4ee5\u5728 package.json \u7684 env \u5c5e\u6027\u4e2d\u6dfb\u52a0 \"HAIBU_INDEPENDENT_SERVICE\": \"true\"\uff0c\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre><code class=\"javascript\">    {\n        \"name\" : \"somesocks\",\n        \"scripts\" : {\n            \"start\" : \"server.js\"\n        },\n        \"env\" : {\n            \"HAIBU_INDEPENDENT_SERVICE\" : \"true\"\n        }\n    }\n<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%E9%97%AE%E9%A2%98%E5%8F%8A%E5%8F%8D%E9%A6%88\"><\/span>\u95ee\u9898\u53ca\u53cd\u9988<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u4f60\u53ef\u4ee5\u5728 GitHub \u4e0a fork \u8fd9\u4e2a\u4ed3\u5e93\uff1a<https: \/\/github.com\/ohdarling\/ukraine><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E8%81%94%E7%B3%BB%E6%88%91\"><\/span>\u8054\u7cfb\u6211<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Twitter: <a href=\"https:\/\/twitter.com\/ohdarling88\">@ohdarling88<\/a><br \/>\nEmail: ohdarling88 at gmail.com<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%84%9F%E8%B0%A2\"><\/span>\u611f\u8c22<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><a href=\"http:\/\/nodejitsu.com\/\">Nodejitsu<\/a> for haibu and other open source projects<\/li>\n<li><a href=\"https:\/\/github.com\/radekstepan\">radekstepan<\/a> for ukraine<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99\"><\/span>\u53c2\u8003\u8d44\u6599<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li><a href=\"https:\/\/github.com\/joyent\/node\/wiki\/Node-Hosting\">https:\/\/github.com\/joyent\/node\/wiki\/Node-Hosting<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/ohdarling\/ukraine\">https:\/\/github.com\/ohdarling\/ukraine<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/radekstepan\/ukraine\">https:\/\/github.com\/radekstepan\/ukraine<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nodejitsu\/haibu\">https:\/\/github.com\/nodejitsu\/haibu<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nodejitsu\/haibu-carapace\">https:\/\/github.com\/nodejitsu\/haibu-carapace<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/joyent\/node\/wiki\/Installing-Node.js-via-package-manager\">Installing Node.js via package manager<\/a><\/li>\n<\/ol>\n<p>--- EOF ---<\/https:><\/http:><\/https:><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6e90\u7531 node.js \u8d8a\u6765\u8d8a\u6d41\u884c\uff0c\u6258\u7ba1 node.js \u5e94\u7528\u7684\u4e91\u670d\u52a1\u4e5f\u8d8a\u6765\u8d8a\u591a\uff0c &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/xujiwei.com\/blog\/2013\/01\/build-private-nodejs-cloud-with-ukraine\/\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[230,231,191,228,232,233,227,229],"_links":{"self":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts\/587"}],"collection":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/comments?post=587"}],"version-history":[{"count":0,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/posts\/587\/revisions"}],"wp:attachment":[{"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/media?parent=587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/categories?post=587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xujiwei.com\/blog\/wp-json\/wp\/v2\/tags?post=587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}