{"id":617,"date":"2020-10-04T00:20:07","date_gmt":"2020-10-03T16:20:07","guid":{"rendered":"<!-- wp:paragraph -->\n<p>\u6b22\u8fce\u8bbf\u95ee <a href=\"http:\/\/francis67.cc:5551\/\">http:\/\/francis67.cc:5551\/<\/a><\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading -->\n<h2>1. \u5b89\u88c5node.js<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u4f7f\u7528 <a rel=\"noreferrer noopener\" href=\"http"},"modified":"2020-10-04T00:45:07","modified_gmt":"2020-10-03T16:45:07","slug":"%e6%a0%91%e8%8e%93%e6%b4%be-%e9%83%a8%e7%bd%b2%e9%9d%99%e6%80%81%e5%8d%9a%e5%ae%a2-hexonginx","status":"publish","type":"post","link":"https:\/\/blog.francis67.cc\/?p=617","title":{"rendered":"\u6811\u8393\u6d3e \u90e8\u7f72\u9759\u6001\u535a\u5ba2 Hexo+Nginx"},"content":{"rendered":"\n<p>\u6b22\u8fce\u8bbf\u95ee <a href=\"http:\/\/francis67.cc:5551\/\">http:\/\/francis67.cc:5551\/<\/a><\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><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><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.francis67.cc\/?p=617\/#1_%E5%AE%89%E8%A3%85nodejs\" >1. \u5b89\u88c5node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.francis67.cc\/?p=617\/#2_%E5%AE%89%E8%A3%85_git\" >2. \u5b89\u88c5 git<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.francis67.cc\/?p=617\/#3_%E5%AE%89%E8%A3%85_Hexo\" >3. \u5b89\u88c5 Hexo<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.francis67.cc\/?p=617\/#4_%E9%83%A8%E7%BD%B2%E5%88%B0nginx\" >4. \u90e8\u7f72\u5230nginx<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blog.francis67.cc\/?p=617\/#X_Hexo_%E7%9B%B8%E5%85%B3\" >X. Hexo \u76f8\u5173<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blog.francis67.cc\/?p=617\/#%E5%8F%82%E8%80%83%E8%BF%9E%E6%8E%A5\" >\u53c2\u8003\u8fde\u63a5<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%E5%AE%89%E8%A3%85nodejs\"><\/span>1. \u5b89\u88c5node.js<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4f7f\u7528 <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/nvm-sh\/nvm\" data-type=\"URL\" data-id=\"https:\/\/github.com\/nvm-sh\/nvm\" target=\"_blank\">NVM<\/a> \u5b89\u88c5<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># install nvm\nwget -qO- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.36.0\/install.sh | bash\n# install nodejs and npm via nvm\nnvm install node<\/pre>\n\n\n\n<p>\u4f7f\u7528 nvm -v, node -v, npm -v \u67e5\u770b\u8fd9\u4e9b\u8f6f\u4ef6\u7684\u7248\u672c\u3002<\/p>\n\n\n\n<p>npm\u66f4\u6362\u6dd8\u5b9d\u6e90\uff0cnpm config set registry https:\/\/registry.npm.taobao.org<br>\u901a\u8fc7npm config get registry \u68c0\u9a8c<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_%E5%AE%89%E8%A3%85_git\"><\/span>2. \u5b89\u88c5 git<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-get install git\nadduser git (psw=git)\ngit init --bare hexo.git\nchown -R git:git hexo.git\nssh-keygen # generate Public key\ncat ~\/.ssh\/id_rsa.pub\nvim \/home\/git\/.ssh\/authorized_keys<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">git config --global user.email \"you@example.com\"\ngit config --global user.name \"Your Name\"<\/pre>\n\n\n\n<p>\u8fd9\u90e8\u5206\u64cd\u4f5c\u901a\u8fc7hook\u5b8c\u6210hexo\u7684\u81ea\u52a8\u53d1\u5e03\u3002<\/p>\n\n\n\n<p>\u590d\u5236post-update.sample\u5e76\u53bb\u6389.sample\uff0cvim \/home\/git\/hexo.git\/hook\/post-update<br>\u5728\u6ce8\u91ca\u540e\u7684\u7b2c\u4e00\u884c\u6dfb\u52a0\uff0cgit &#8211;work-tree=\/home\/git &#8211;git-dir=\/home\/git\/hexo.git checkout -f<br>\u4fee\u6539\u6587\u4ef6\u5c5e\u6027\uff0cchmod +x post-update<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_%E5%AE%89%E8%A3%85_Hexo\"><\/span>3. \u5b89\u88c5 Hexo<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"># <a href=\"https:\/\/github.com\/hexojs\/hexo\">https:\/\/github.com\/hexojs\/hexo<\/a>\nnpm install -g hexo-cli\n#\nhexo init myblog \/\/'myblog' can be any name\ncd myblog \/\/enter 'myblog' dir \nnpm install\n\nhexo server<\/pre>\n\n\n\n<p>\u901a\u8fc7\u6253\u5f00 http:\/\/localhost:4000\uff0c\u5373\u53ef\u4ee5\u770b\u5230\u914d\u7f6e\u597d\u7684\u9875\u9762\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u7684\u64cd\u4f5c\u901a\u8fc7git\u628ahexo\u90e8\u7f72\u5230nginx\u4e0a\u3002<\/p>\n\n\n\n<p>\u7f16\u8f91\u914d\u7f6e\uff0cvim \/home\/pi\/myblog\/_config.yml<br>\u4fee\u6539#deploy\u5982\u4e0b\uff0c&lt;your server IP&gt; \u6211\u586b\u4e86127.0.0.1<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">deploy:\n  type: git\n  repo: git@&lt;your server IP&gt;:\/home\/git\/hexo.git  \n  branch: master<\/pre>\n\n\n\n<p>\u5728 \/myblog \u6587\u4ef6\u5939\u4e2d\u5b89\u88c5hexo-deployer-git<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">npm install hexo-deployer-git --save\nhexo new &lt;blog_title&gt;\nhexo g -d<\/pre>\n\n\n\n<p>\u91cd\u65b0\u90e8\u7f72\u540e\uff0c\u901a\u8fc7 server_IP:8080\uff0c\u5373\u53ef\u4ee5\u8bbf\u95ee\u4f7f\u7528git\u90e8\u7f72\u7684hexo\u9875\u9762\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_%E9%83%A8%E7%BD%B2%E5%88%B0nginx\"><\/span>4. \u90e8\u7f72\u5230nginx<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4fee\u6539 sudo vim \/etc\/nginx\/sites-available\/default&nbsp; \u76f8\u5173\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">https {\n\u2026\nserver {\nlisten 8080;\n<strong><span class=\"has-inline-color has-blue-color\">root \/home\/git;<\/span><\/strong>\nserver_name localhost;\n<code>location \/ { index index.html index.htm; } } ...<\/code>\n}<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">service nginx restart<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"X_Hexo_%E7%9B%B8%E5%85%B3\"><\/span>X. Hexo \u76f8\u5173<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5b89\u88c5 <a href=\"https:\/\/theme-next.js.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">NexT <\/a>\u4e3b\u9898<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83%E8%BF%9E%E6%8E%A5\"><\/span>\u53c2\u8003\u8fde\u63a5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/skywalkeratlas.github.io\/2019\/02\/04\/blog-hexo-git-nginx\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u5149\u901f(\u5927\u96fe)\u535a\u5ba2\u914d\u7f6eI &#8212; Hexo+git+Nginx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b22\u8fce\u8bbf\u95ee http:\/\/francis67.cc:5551\/ 1. \u5b89\u88c5node.js \u4f7f\u7528 NVM \u5b89\u88c5 # [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[215,216,212,211],"class_list":["post-617","post","type-post","status-publish","format-standard","hentry","category-vpslog","tag-hexo","tag-node-js","tag-raspberry-pi","tag-211"],"_links":{"self":[{"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/posts\/617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=617"}],"version-history":[{"count":39,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/posts\/617\/revisions"}],"predecessor-version":[{"id":656,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=\/wp\/v2\/posts\/617\/revisions\/656"}],"wp:attachment":[{"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.francis67.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}