{"id":305,"date":"2020-03-22T15:55:55","date_gmt":"2020-03-22T07:55:55","guid":{"rendered":"https:\/\/www.wangliguang.cn\/?p=305"},"modified":"2020-03-22T15:55:55","modified_gmt":"2020-03-22T07:55:55","slug":"%e4%bb%8e%e9%9b%b6%e5%bc%80%e5%a7%8b%e6%90%ad%e5%bb%baghost%e5%8d%9a%e5%ae%a2-ubuntu18-04-%e4%bd%bf%e7%94%a8%e8%85%be%e8%ae%af%e4%ba%91%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/wangliguang.cn\/?p=305","title":{"rendered":"\u4ece\u96f6\u5f00\u59cb\u642d\u5efaGhost\u535a\u5ba2-Ubuntu18.04-\u4f7f\u7528\u817e\u8baf\u4e91\u6570\u636e\u5e93"},"content":{"rendered":"<p>\u7f51\u4e0a\u6709\u5f88\u591a\u642d\u5efaghost\u535a\u5ba2\u7684\u6559\u7a0b\uff0c\u4f46\u662f\u6709\u7684\u6b65\u9aa4\u4e0d\u8be6\u7ec6\uff0c\u4e5f\u5c11\u6709\u4f7f\u7528\u4e91\u6570\u636e\u5e93\u642d\u5efa\u7684\u6559\u7a0b\uff0c\u57fa\u672c\u90fd\u662f\u672c\u5730\u6570\u636e\u5e93\u3002\u8fd9\u7bc7\u6559\u7a0b\u7684\u76ee\u7684\u5c31\u662f\u60f3\u8981\u6559\u5927\u5bb6\u4e00\u6b65\u4e00\u6b65\u642d\u5efaghost\u535a\u5ba2\uff0c<strong>\u540c\u65f6\u628a\u6570\u636e\u5e93\u653e\u5728\u817e\u8baf\u4e91\u6570\u636e\u5e93\u4e0a\uff0c\u4e0d\u518d\u4f7f\u7528\u672c\u5730\u6570\u636e\u5e93<\/strong>\u3002<\/p>\n<h2>\u4e00\u3001\u6240\u9700\u73af\u5883<\/h2>\n<p>\u534e\u4e3a\u4e91\u670d\u52a1\u5668\uff08\u914d\u7f6e\uff1a\u5185\u5b582G\uff0c\u786c\u76d840G\uff0c\u64cd\u4f5c\u7cfb\u7edfUbuntu 18.04\uff09<br \/>\n\u817e\u8baf\u4e91\u6570\u636e\u5e93\uff08\u7c7b\u578b\uff1aMySQL\uff0c\u7248\u672c5.7\uff09<\/p>\n<h2>\u4e8c\u3001\u8be6\u7ec6\u6b65\u9aa4<\/h2>\n<h3>1\u3001\u5b89\u88c5GCC\u548cG++<\/h3>\n<p>1.1\u3001\u9996\u5148\u67e5\u770b\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<br \/>\n<code>gcc --version<\/code><br \/>\n<code>g++ --version<\/code><br \/>\n\u5982\u679c\u6b63\u786e\u663e\u793a\u7248\u672c\u5219\u5df2\u7ecf\u5b89\u88c5\uff0c\u76f4\u63a5\u8fdb\u5165\u4e0b\u4e00\u6b65\u64cd\u4f5c\u3002\u5426\u5219\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<pre><code class=\"\">sudo apt-get install gcc\nsudo apt-get install g++\n<\/code><\/pre>\n<p>1.2\u3001\u5982\u679c\u6ca1\u6709\u5b89\u88c5\u5f00\u53d1\u7f16\u8bd1\u5de5\u5177\u5305\uff0c\u5219\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<pre><code class=\"\">sudo apt-get install build-essential\n<\/code><\/pre>\n<h3>2\u3001\u5b89\u88c5Node.js<\/h3>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5b89\u88c5Node.js<\/p>\n<pre><code class=\"\">sudo curl -sL https:\/\/deb.nodesource.com\/setup_10.x | sudo -E bash -\nsudo apt-get install -y nodejs\n<\/code><\/pre>\n<h3>3\u3001\u5b89\u88c5nginx<\/h3>\n<p>3.1\u3001\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Nginx\u3002<\/p>\n<pre><code class=\"\">sudo apt-get update\nsudo apt-get install nginx\n<\/code><\/pre>\n<p>3.2\u3001\u9a8c\u8bc1\u662f\u5426\u6b63\u786e\u5b89\u88c5\uff1a<br \/>\n\u5728\u6d4f\u89c8\u5668\u4e2d\u901a\u8fc7\u57df\u540d\u6216\u8005 IP \u5730\u5740\u8fdb\u884c\u8bbf\u95eeNginx\uff0c\u5982\u679cNginx\u6b63\u5e38\u542f\u52a8\u5219\u4f1a\u6253\u5f00Welcome to nginx\u7684\u6b22\u8fce\u9875\u9762\u3002<br \/>\n3.3\u3001\u914d\u7f6eNginx<br \/>\n\u65b0\u5efa\u914d\u7f6e\u6587\u4ef6<br \/>\n<code>vim \/etc\/nginx\/sites-available\/ghost.conf<\/code><br \/>\n\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre><code class=\"\">server {\n    listen 80;\n    server_name xx.xxx; #\u8fd9\u91cc\u5199\u81ea\u5df1\u7684\u57df\u540d\u6216\u8005ip\u5730\u5740\n    location \/ {\n        proxy_set_header   X-Real-IP $remote_addr;\n        proxy_set_header   Host      $http_host;\n        proxy_pass         http:\/\/127.0.0.1:2368;\n    }\n}\n<\/code><\/pre>\n<p>3.4\u3001\u628a\u914d\u7f6e\u6587\u4ef6\u8f6f\u94fe\u63a5\u5230sites-enabled\u4e2d:<br \/>\nsudo ln -s \/etc\/nginx\/sites-available\/ghost.conf \/etc\/nginx\/sites-enabled\/ghost.conf<br \/>\n3.5\u3001\u91cd\u542fNginx<br \/>\nsudo service nginx restart<\/p>\n<h3>4\u3001\u521b\u5efa\u65b0\u7528\u6237<\/h3>\n<p>4.1\u3001\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u521b\u5efa\u65b0\u7528\u6237\u3002<br \/>\n<code>adduser \u4f60\u7684\u7528\u6237\u540d<\/code><br \/>\n\u8f93\u5165\u6b64\u547d\u4ee4\u540e\uff0c\u4f1a\u8981\u6c42\u4f60\u8f93\u5165\u5bc6\u7801\uff0c\u81ea\u5df1\u8bbe\u7f6e\u5373\u53ef\u3002<br \/>\n\u7136\u540e\u8981\u6c42\u4f60\u8f93\u5165\u4e00\u7cfb\u5217\u4fe1\u606f\uff0c\u6211\u4eec\u76f4\u63a5\u6309\u56de\u8f66\u8868\u793a\u9ed8\u8ba4\u5373\u53ef\u3002<br \/>\n\u6700\u540e\u95ee\u4f60\u662f\u5426\u786e\u8ba4\uff0c\u8f93\u5165y<br \/>\n4.2\u3001\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5c06\u65b0\u521b\u5efa\u7684\u7528\u6237\u6dfb\u52a0\u5230superuser\u7ec4\u3002<br \/>\n<code>usermod -aG sudo \u4f60\u521a\u624d\u521b\u5efa\u7684\u7528\u6237\u540d<\/code><br \/>\n4.3\u3001\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5207\u6362\u5230\u4f60\u521a\u624d\u521b\u5efa\u7684\u7528\u6237\u3002<br \/>\n<code>su \u4f60\u521a\u624d\u521b\u5efa\u7684\u7528\u6237\u540d<\/code><\/p>\n<h3>5\u3001\u5b89\u88c5Ghost-CLI<\/h3>\n<p><code>sudo npm i -g ghost-cli<\/code><\/p>\n<h3>6\u3001\u5b89\u88c5Ghost<\/h3>\n<p>6.1\u3001\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\uff1a<br \/>\n<code>sudo mkdir -p \/var\/www\/ghost<\/code><br \/>\n6.2\u3001\u66f4\u6539\u6240\u6709\u8005\uff1a<br \/>\n<code>sudo chown [user]:[user] \/var\/www\/ghost<\/code><br \/>\n6.3\u3001\u8fdb\u5165\u6211\u4eec\u521a\u624d\u521b\u5efa\u7684\u6587\u4ef6\u5939\uff1a<br \/>\n<code>cd \/var\/www\/ghost\/<\/code><br \/>\n6.4\u3001\u7528Ghost-CLI \u5b89\u88c5Ghost\u3002<br \/>\n<code>ghost install<\/code><br \/>\n\u63a5\u4e0b\u6765\u4f1a\u63d0\u793a\u6211\u4eec\u6ca1\u6709\u627e\u5230\u672c\u5730\u6570\u636e\u5e93\uff1a<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wangliguang.cn\/wp-content\/uploads\/2020\/03\/\u6279\u6ce8-2020-03-22-154212.png\" alt=\"\" \/><br \/>\n<strong>\u7531\u4e8e\u6211\u4eec\u8981\u4f7f\u7528\u4e91\u6570\u636e\u5e93\uff0c\u6240\u4ee5\u65e0\u9700\u672c\u5730\u5b89\u88c5\u6570\u636e\u5e93\uff0c\u6240\u4ee5\u76f4\u63a5\u8f93\u5165y\uff0c\u6309\u4e0b\u56de\u8f66<\/strong><br \/>\n\u63a5\u4e0b\u4f1a\u8fdb\u884c\u914d\u7f6e\uff1a<br \/>\n\u5728\u914d\u7f6e\u6570\u636e\u5e93\u7684\u65f6\u5019\uff0chost\u586b\u5199<strong>\u4e91\u6570\u636e\u5e93\u5730\u5740<\/strong>\uff0cusername\u586b\u5199<strong>\u4e91\u6570\u636e\u5e93\u7528\u6237\u540d<\/strong>\uff0c\u8868\u540d<strong>\u586b\u5199\u4e8b\u5148\u5728\u4e91\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u597d\u7684\u8868\u540d\u3002\u5bc6\u7801\u586b\u5199\u4e91\u6570\u636e\u5e93\u5bc6\u7801\u3002<\/strong>\u5982\u679c\u4f60\u7684\u4e91\u670d\u52a1\u5668\u548c\u4e91\u6570\u636e\u5e93<strong>\u4e0d\u5728\u540c\u4e00\u53ef\u7528\u533a\u4e4b\u5185\uff0c\u4f60\u9700\u8981\u4f7f\u7528\u5916\u7f51\u5730\u5740\uff0c\u5426\u5219\u4f7f\u7528\u5185\u7f51\u5373\u53ef<\/strong>\u3002<br \/>\n\u6ce8\u610f\uff0c\u6709\u4e91\u6570\u636e\u5e93\u5982\u4f55\u521b\u5efa\u7528\u6237\u3001\u521b\u5efa\u6570\u636e\u5e93\u3001\u5185\u7f51\u5916\u7f51\u662f\u4ec0\u4e48\u7b49\u57fa\u672c\u6982\u5ff5\uff0c\u8bf7\u53c2\u8003\u817e\u8baf\u4e91\u5b98\u65b9\u6587\u6863\uff0c\u6216\u53c2\u8003\u672c\u7ad9\u4eca\u540e\u4f1a\u63a8\u51fa\u7684\u6587\u7ae0\u3002<br \/>\n\u6839\u636e\u4f5c\u8005\u7684\u5b9e\u9645\u7ecf\u9a8c\uff0c<strong>\u7531\u4e8e\u8bbf\u95ee\u4e91\u6570\u636e\u5e93\u9700\u8981\u5728\u5730\u5740\u540e\u9762\u52a0\u7aef\u53e3\uff0c\u800c\u5c06\u5730\u5740:\u7aef\u53e3\u76f4\u63a5\u5199\u5728\u4e0a\u9762host\u4e2d\u5e76\u4e0d\u80fd\u8ba9\u914d\u7f6e\u6210\u529f<\/strong>\uff0c\u9700\u8981\u5355\u72ec\u4f7f\u7528<code>vi config.production.json<\/code>\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\uff0c<strong>\u5728\u6709\u5173\u6570\u636e\u5e93\u7684\u914d\u7f6e\u4e2d\u52a0\u4e00\u9879port<\/strong>\uff0c\u586b\u5199\u4e91\u6570\u636e\u5e93\u7684\u7aef\u53e3\u3002<br \/>\n\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<h3>7\u3001\u5f00\u59cb\u914d\u7f6e\u7528\u6237<\/h3>\n<p>\u81f3\u6b64\u5b89\u88c5\u5b8c\u6210\uff0c\u8bbf\u95ee<strong>http:\/\/\u4f60\u7684IP\u6216\u57df\u540d\/ghost<\/strong>\u6309\u7cfb\u7edf\u8bf4\u660e\u914d\u7f6e\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7f51\u4e0a\u6709\u5f88\u591a\u642d\u5efaghost\u535a\u5ba2\u7684\u6559\u7a0b\uff0c\u4f46\u662f\u6709\u7684\u6b65\u9aa4\u4e0d\u8be6\u7ec6\uff0c\u4e5f\u5c11\u6709\u4f7f\u7528\u4e91\u6570\u636e\u5e93\u642d\u5efa\u7684\u6559\u7a0b\uff0c\u57fa\u672c\u90fd\u662f\u672c\u5730\u6570\u636e\u5e93\u3002\u8fd9\u7bc7&hellip; <a href=\"https:\/\/wangliguang.cn\/?p=305\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">\u4ece\u96f6\u5f00\u59cb\u642d\u5efaGhost\u535a\u5ba2-Ubuntu18.04-\u4f7f\u7528\u817e\u8baf\u4e91\u6570\u636e\u5e93<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,14,24],"tags":[28,36,45],"class_list":["post-305","post","type-post","status-publish","format-standard","hentry","category-diy","category-14","category-24","tag-diy","tag-36","tag-45"],"_links":{"self":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts\/305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=305"}],"version-history":[{"count":0,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions"}],"wp:attachment":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}