{"id":17,"date":"2018-07-04T12:48:47","date_gmt":"2018-07-04T04:48:47","guid":{"rendered":"http:\/\/blog.wwhhoo.com\/?p=17"},"modified":"2018-07-04T12:48:47","modified_gmt":"2018-07-04T04:48:47","slug":"%e8%85%be%e8%ae%af%e4%ba%91%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ae%89%e5%85%a8%e7%bb%84%e7%ad%96%e7%95%a5%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/blog2.wwhhoo.com\/?p=17","title":{"rendered":"\u817e\u8baf\u4e91\u670d\u52a1\u5668\u5b89\u5168\u7ec4\u7b56\u7565\u95ee\u9898"},"content":{"rendered":"<p>\u5728\u5b89\u88c5nodejs, \u67b6\u8bbenodejs http\u670d\u52a1\u65f6\uff0c\u53d1\u73b0\u8fd9\u4e2a\u4ee5\u4e0b\u95ee\u9898\u3002<\/p>\n<p>\u591a\u6b21\u5c1d\u8bd5\u5b89\u5168\u7ec4\u7b56\u7565\u540e\u53d1\u751f\uff0c\u7aef\u53e3\u9ad8\u4e8e3000\u7684http\u670d\u52a1\u65e0\u6cd5\u901a\u8fc7\u5b89\u5168\u7ec4\u7b56\u7565\uff0c\u5373\u4f7f\u5728\u5b89\u5168\u7ec4\u7b56\u7565\u4e2d\u6253\u5f00\u6240\u6709\u7aef\u53e3\u4e5f\u4e0d\u884c\u3002<\/p>\n<p>\u901a\u8fc7\u5185\u7f51\u53ef\u4ee5\u6b63\u5e38\u8bbf\u95ee3000\u7aef\u53e3\uff0c\u4f46\u5916\u7f51\u65e0\u6cd5\u8bbf\u95ee\u3002<\/p>\n<p>\u53ef\u901a\u8fc7ngnix\u4ee3\u74063000\u7aef\u53e3\u89e3\u51b3\u3002<\/p>\n<div>\n<blockquote>\n<div>sever{<\/div>\n<div><\/div>\n<div># pass the request to the node.js server with the correct headers<\/div>\n<div>\u00a0\u00a0# and much more can be added, see nginx config options<\/div>\n<div>\u00a0\u00a0location \/nodejs {<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0proxy_set_header X-Real-IP $remote_addr;<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0proxy_set_header Host $http_host;<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0proxy_set_header X-NginX-Proxy true;<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0proxy_pass http:\/\/app_timesheet\/;<\/div>\n<div>\u00a0\u00a0\u00a0\u00a0proxy_redirect off;<\/div>\n<div>\u00a0\u00a0}<\/div>\n<div>}<\/div>\n<div># the IP(s) on which your node server is running. I chose port 3001.<\/div>\n<div>upstream app_timesheet {<\/div>\n<div>server 127.0.0.1:3001;<\/div>\n<div>keepalive 8;<\/div>\n<div>}<\/div>\n<\/blockquote>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5b89\u88c5nodejs, \u67b6\u8bbenodejs http\u670d\u52a1\u65f6\uff0c\u53d1\u73b0\u8fd9\u4e2a\u4ee5\u4e0b\u95ee\u9898\u3002 \u591a\u6b21\u5c1d\u8bd5\u5b89\u5168\u7ec4\u7b56\u7565\u540e\u53d1\u751f\uff0c\u7aef\u53e3\u9ad8\u4e8e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[14],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-http"],"_links":{"self":[{"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":0,"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog2.wwhhoo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}