{"id":3082,"date":"2019-04-05T19:15:13","date_gmt":"2019-04-05T11:15:13","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=3082"},"modified":"2019-04-05T23:07:23","modified_gmt":"2019-04-05T15:07:23","slug":"%e3%80%8c%e6%90%ad%e5%bb%baghost%e5%8d%9a%e5%ae%a2%e3%80%8d%e7%bb%8f%e5%85%b8%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/3082","title":{"rendered":"\u300c\u642d\u5efaGhost\u535a\u5ba2\u300d\u7ecf\u5178\u6559\u7a0b"},"content":{"rendered":"<div class=\"post-topheader custom- pt0\">\n<div class=\"mb20\">\n<div class=\"block-for-right-border\">\n<div class=\"row\">\n<div class=\"col-md-12 col-sm-12 col-xs-12\">\n<div class=\"post-topheader__info\" data-username=\"mousycoder\" data-userslug=\"mousycoder\" data-useravatar=\"https:\/\/avatar-static.segmentfault.com\/395\/853\/3958533551-5c347c5fe1a93_big64\">\n<div class=\"content__tech hidden-xs\">\n<p>\u00a041.9k \u6b21\u9605\u8bfb \u00a0\u00b7\u00a0 \u8bfb\u5b8c\u9700\u8981 30 \u5206\u949f<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"visible-lg\">\n<div class=\"side-widget\">\n<div id=\"side-widget-votes-btn\" class=\"stream__item-zan btn btn-default mt0 mb15 ml0 mr0 pt0 pb0 pl0 pr0 \"><span id=\"side-widget-votes-num\" class=\"stream__item-zan-number\">8<\/span><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div class=\"article fmt article__content\" data-id=\"1190000002947497\" data-license=\"cc\">\n<p><strong><a href=\"http:\/\/www.ghostchina.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ghost<\/a><\/strong>\u662f\u4e00\u6b3e\u975e\u5e38\u51fa\u8272\u7684\u5f00\u6e90\u535a\u5ba2\u5e73\u53f0\uff0c\u65e0\u8bba\u662f\u4ece\u67b6\u6784\u3001\u8bbe\u8ba1\u3001\u6613\u7528\u6027\uff0c\u5b83\u90fd\u8981\u6bd4<strong><a href=\"https:\/\/cn.wordpress.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">WordPress<\/a><\/strong>\u8981\u597d\uff0c\u754c\u9762\u7b80\u6d01\uff0c\u4e13\u6ce8\u5199\u4f5c\uff0c\u652f\u6301\u5728\u7ebf\u9884\u89c8\uff0c\u5728\u7ebf\u5199\u4f5c\uff0c\u65e0\u8bba\u60a8\u662f\u5728\u54ea\u91cc\uff0c\u90fd\u53ef\u4ee5\u53bb\u5199\u535a\u5ba2\uff0c\u5c3d\u60c5\u7684\u4eab\u53d7\u5199\u4f5c\u5e26\u6765\u7684\u5feb\u611f\u3002<\/p>\n<h2 id=\"articleHeader0\">\u4f18\u52bf<\/h2>\n<ul>\n<li>\u6280\u672f\u4e0a,\u91c7\u7528<a href=\"https:\/\/nodejs.org\/en\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NodeJs<\/a>\uff0c\u5728\u53ef\u9884\u89c1\u7684\u672a\u6765\u91cc\uff0c\u65e0\u7591\u6bd4<a href=\"http:\/\/php.net\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">PHP<\/a>\u6709\u66f4\u591a\u4f18\u52bf\uff0c\u5e76\u53d1\u80fd\u529b\u8fdc\u8d85Wordpress\uff0c\u867d\u7136NodeJs\u540e\u671f\u7ef4\u62a4\u6210\u672c\u9ad8\uff0c\u4f46\u662f\u6211\u4eec\u53ea\u662f\u501f\u5b83\u505a\u535a\u5ba2\u800c\u5df2\u3002<\/li>\n<li>\u6613\u7528\u6027\u4e0a\uff0c\u4e13\u6ce8\u5199\u4f5c\uff0c\u8bc4\u8bba\uff0c\u8d85\u70ab\u76ae\u80a4\uff0c\u5b8c\u7f8e\u652f\u6301 MarkDown,\u6ca1\u6709Wordpress\u90a3\u4e48\u81c3\u80bf\uff0c\u56de\u5f52\u5230\u535a\u5ba2\u6700\u539f\u59cb\u7684\u72b6\u6001,\u4f20\u9012\u6587\u5b57\u6700\u539f\u59cb\u7684\u529b\u91cf\u3002<\/li>\n<li>\u4f7f\u7528\u4e0a\uff0c\u4fbf\u6377\uff0c\u968f\u65f6\u968f\u5730\u7f16\u8f91\uff0c\u6bd4<a href=\"http:\/\/hexo.io\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Hexo<\/a>,<a href=\"http:\/\/jekyllrb.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jekyll<\/a>\u8fd9\u7c7b\u9759\u6001\u535a\u5ba2\u8981\u4e66\u5199\u65b9\u4fbf\uff0c\u7279\u522b\u662f\u5728\u4e0d\u540c\u7535\u8111\u4e0a\u5199\u4f5c\u65f6\u3002<\/li>\n<\/ul>\n<h2 id=\"articleHeader1\">\u52a3\u52bf<\/h2>\n<ul>\n<li>\u9700\u8981\u914d\u5957\u652f\u6301Node\u73af\u5883\u7684\u865a\u62df\u673a\uff0c\u4e00\u822c\u514d\u8d39\u7684\u5f88\u5c11\u652f\u6301\uff0c\u8fd9\u65f6\u5fc5\u987b\u5f97\u638f\u8170\u5305\u4e86\u3002<\/li>\n<li>\u540e\u53f0\u7b80\u964b,\u8bb8\u591a\u529f\u80fd\u8fd8\u672a\u5b8c\u5584\uff0c\u4e0d\u8fc7\u5199\u4f5c\u8fd9\u4e00\u5757\u6ca1\u5565\u5927\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h2 id=\"articleHeader2\">\u4eae\u70b9<\/h2>\n<ul>\n<li>\u91c7\u7528<strong><a href=\"http:\/\/www.ghostchina.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ghost\u4e2d\u6587\u7248\u6700\u65b0\u72480.6.3<\/a><\/strong>\u4fdd\u8bc1\u4e86\u6700\u65b0\u529f\u80fd\u4ee5\u53ca\u6559\u7a0b\u7684\u5b9e\u65f6\u6027,\u76ee\u524d\u5df2\u7ecf\u66f4\u65b0\u5230\u4e860.7.0,\u6559\u7a0b\u6240\u5199\u65e5\u671f\u65f6\uff0c\u6700\u65b0\u7248\u672c\u4e3a0.6.3\u3002<\/li>\n<li>\u91c7\u7528Mysql\u4f5c\u4e3a\u6570\u636e\u5e93,\u901a\u7528\u5feb\u901f\u4e0a\u624b\uff0c\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u7528\u5176\u4ed6\u6570\u636e\u5e93\u6bd4\u5982Sqlite\u3002<\/li>\n<li>Nginx\u4f5c\u4e3a\u53cd\u5411\u4ee3\u7406,\u914d\u7f6e\u591a\u4e2aGhost\u535a\u5ba2,\u540c\u65f6\u4e5f\u80fd\u589e\u52a0\u4e86\u7f51\u7ad9\u7684\u8d1f\u8f7d\u3002<\/li>\n<li>\u975e\u5e38\u7b80\u6613\u5316\u7684Ubuntu\u7684Node.js\u5b89\u88c5\u65b9\u6cd5\uff0c\u4e0d\u7528\u7f16\u8bd1\u6253\u5305\u3002<\/li>\n<li>\u5b89\u88c5\u7cfb\u7edf\u670d\u52a1,\u5f00\u673a\u91cd\u542fGhost\u670d\u52a1\uff0c\u514d\u53bb\u65e5\u540e\u4ee5\u540e\u64cd\u4f5c\u3002<\/li>\n<li>\u91c7\u7528<a href=\"http:\/\/fontawesome.io\/icons\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Font Awesome<\/a>\u4f5c\u4e3a\u793e\u4ea4\u6309\u94ae\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u56fe\u6807\u3002<\/li>\n<li><a href=\"http:\/\/highlightjs.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">highlight.js<\/a>\u00a0\u4f5c\u4e3a\u4e3b\u9898\u7684\u4ee3\u7801\u9ad8\u4eae\u5f15\u64ce<\/li>\n<li>\u6574\u5408<a href=\"https:\/\/disqus.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Disqus<\/a>\u8bc4\u8bba\u7cfb\u7edf,\u5efa\u7acb\u5c5e\u4e8e\u81ea\u5df1\u7684Discuss\u5708<\/li>\n<li>\u56fd\u5916\u4f18\u79c0\u514d\u8d39<a href=\"http:\/\/themeforest.net\/category\/blogging\/ghost-themes\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ghost\u4e3b\u9898<\/a>\u8d44\u6e90\u5206\u4eab<\/li>\n<li>\u6574\u5408<a href=\"http:\/\/tongji.baidu.com\/web\/welcome\/login\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u767e\u5ea6\u7edf\u8ba1<\/a>\u4ee5\u53ca<a href=\"http:\/\/share.baidu.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u767e\u5ea6\u5206\u4eab<\/a><\/li>\n<\/ul>\n<p><strong>\u5e9f\u8bdd\u4e0d\u591a\u8bf4\uff0c\u76f4\u63a5\u4e0a\u5e72\u8d27\uff01<\/strong><\/p>\n<h2 id=\"articleHeader3\">\u73af\u5883<\/h2>\n<p>Ubuntu 14.04,MySql 5.5.43,Nginx 1.4.6,Node 0.10.33<\/p>\n<h2 id=\"articleHeader4\">\u6b65\u9aa4<\/h2>\n<h3 id=\"articleHeader5\">\u5b89\u88c5MySql<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># \u5b89\u88c5MySql\r\n$ apt-get update # \u66f4\u65b0\u7ec4\u4ef6\r\n$ apt-get install mysql-server mysql-client -y # \u5feb\u901f\u5b89\u88c5-y\u4ee3\u8868\u9ed8\u8ba4\u9009\u62e9y\u7701\u53bb\u4e86\u56de\u8f66\uff0c\u8fd9\u65f6\u53ea\u9700\u8981\u8bbe\u7f6emysql\u7684root\u5bc6\u7801\r\n\r\n# \u8bbe\u7f6emysql\u7684\u7f16\u7801\r\n$ sudo vi \/etc\/mysql\/my.cnf # \u641c\u7d22\u5230[mysqld] \u63d2\u5165collation-server = utf8_unicode_ci init-connect = 'SET NAMES utf8' character-set-server = utf8\r\n$ service mysql restart # \u91cd\u542f\u751f\u6548\r\n$ mysql -u root -p # \u8f93\u5165\u4e0a\u9762\u8bbe\u7f6e\u7684\u5bc6\u7801\r\n$ show variables like 'char%'\r\n$ show variables like 'collation%' # \u67e5\u770b\u662f\u5426\u6539\u6210utf-8\u4e86\u5426\u5219\u4e4b\u540e\u6570\u636e\u5e93\u5185\u5b58\u4e2d\u6587\u5b58\u653e\u7684\u662f\u4e71\u7801\r\n\r\n# \u521b\u5efaGhost\u6570\u636e\u5e93\r\n$ create database mousycoder # \u8fd9\u91cc\u628amousycoder\u6362\u6210\u4f60\u60f3\u6362\u6210\u7684\u6570\u636e\u5e93\u540d\uff0c\u5efa\u8bae\u548c\u57df\u540d\u4fdd\u6301\u4e00\u81f4\uff0c\u65b9\u4fbf\u4ee5\u540e\u7ef4\u62a4\u3002\r\n$ create database mousycoderDev # \u8fd9\u4e2a\u662fGhost\u542f\u52a8\u67092\u79cd\u6a21\u5f0f \u4e00\u79cd\u5f00\u53d1\u6a21\u5f0f \u4e00\u79cd\u751f\u4ea7\u6a21\u5f0f \u8fd9\u4e2a\u662f\u5f00\u53d1\u6a21\u5f0f\u7684\u6570\u636e\u5e93\uff0c\u5982\u679c\u4e0d\u60f3\u90a3\u4e48\u9ebb\u70e6\uff0c\u53ea\u7528\u5efa\u7acb\u4e00\u4e2a\u6570\u636e\u5e93\u5373\u53ef\u3002\r\n$ create user 'mousycoder'@'localhost' identified by '123456' # \u8fd9\u91cc\u65b0\u5efa\u4e00\u4e2a\u7528\u6237mousycoder\u5bc6\u7801\u4e3a123456,\u5f53\u7136\u6211\u7684\u5bc6\u7801\u80af\u5b9a\u4e0d\u662f123456\u54af\uff0c\u6362\u6210\u4f60\u81ea\u5df1\u7684\u5566 = =\uff0c\u540c\u6837\u4e5f\u5efa\u8bae\u7528\u6237\u540d\uff0c\u6570\u636e\u5e93\u540d\uff0c\u670d\u52a1\u540d\uff0c\u7ec4\u540d\uff0c\u90fd\u548c\u57df\u540d\u4fdd\u6301\u4e00\u81f4,\u8fd9\u91cc\u662f\u5efa\u7acb\u4e00\u4e2a\u53ea\u6709\u672c\u5730\u64cd\u4f5c\u7684\u7528\u6237\uff0c\u8fdc\u7a0b\u65e0\u6cd5\u64cd\u4f5c\uff0c\u5b89\u5168\u7b56\u7565\u3002\r\n$ grant all privileges on mousycoder.* to 'mousycoder'@'localhost'\r\n$ grant all privileges on mousycoderDev.* to 'mousycoder'@'localhost' # \u8fd9\u91cc\u662f\u8d4b\u4e88mousycoder\u8fd9\u4e2a\u672c\u5730\u7528\u6237\u6240\u6709\u5bf9\u6570\u636e\u5e93mousycoder\u4ee5\u53camousycoderDev\u7684\u6743\u9650\uff0c\u5f53\u7136\u8fd9\u91cc\u4f60\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u8981\u8d4b\u4e88\u6743\u9650\u3002\r\n$ FLUSH PRIVILEGES # \u91cd\u65b0\u8bfb\u53d6\u6743\u9650\u8868\u4e2d\u7684\u6570\u636e\u5230\u5185\u5b58\uff0c\u4e0d\u7528\u91cd\u542fmysql\u5c31\u53ef\u4ee5\u8ba9\u6743\u9650\u751f\u6548\uff0c\u597d\u5904\u53ef\u4ee5\u9632\u6b62\u4fee\u6539\u9519\u8bef\u540e\uff0c\u6ca1\u6709\u4f59\u5730\u518d\u53bb\u53cd\u6094\u3002<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u8865\u5145\u8bf4\u660e<\/strong><\/p>\n<ul>\n<li>mysql \u79fb\u9664\u533f\u540d\u8d26\u6237\uff0c\u7981\u7528root\u8fdc\u7a0b\u767b\u5f55\uff1a\u00a0<code>$ sudo mysql_secure_installation;<\/code>\u00a0\u56de\u7b54n,y,y,y,y<\/li>\n<li>grant \u7528\u6cd5\uff1agrant \u6743\u96501,\u6743\u96502,\u2026\u6743\u9650n on \u6570\u636e\u5e93\u540d\u79f0.\u8868\u540d\u79f0 to \u7528\u6237\u540d@\u7528\u6237\u5730\u5740 identified by &#8216;\u53e3\u4ee4&#8217;<br \/>\n\u5176\u4e2d\u6743\u96501,\u6743\u96502,\u2026\u6743\u9650n\u4ee3\u8868 select,insert,update,delete,create,drop,<\/li>\n<\/ul>\n<p>index,alter,grant,reload,references,shutdown,process,file14\u4e2a\u6743\u9650\u3002<br \/>\n\u4f8b\u5982\uff1a`grant select,insert,update,delete,create,drop on mousycoder.employee to<br \/>\nhello@10.163.225.87 identified by \u2018123456\u2032`<br \/>\n\u4ee3\u8868\u7ed9\u6765\u81ea10.163.225.87\u7684\u7528\u6237hello\u5206\u914d\u53ef\u5bf9\u6570\u636e\u5e93mousycoder\u7684employee\u8868\u8fdb\u884cselect,insert,update,delete,create,drop\u7b49\u64cd\u4f5c\u7684\u6743\u9650\uff0c\u5e76\u8bbe\u5b9a\u53e3\u4ee4\u4e3a123456\u3002<\/p>\n<ul>\n<li>mysql\u4e71\u7801\u539f\u56e0\u8be6\u7ec6\u89e3\u53ef\u4ee5\u53c2\u8003<a href=\"http:\/\/www.cnblogs.com\/hongfei\/archive\/2011\/12\/29\/set-names-utf8.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u66fe\u662f\u571f\u6728\u4eba<\/a>\u7684\u535a\u5ba2<\/li>\n<\/ul>\n<h3 id=\"articleHeader6\">\u5b89\u88c5Nginx<\/h3>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># \u5b89\u88c5nginx\r\n$ apt-get install nginx -y \r\n$ apt-get install curl -y # curl\u662f\u4e00\u79cd\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u4f5c\u7528\u662f\u53d1\u51fa\u7f51\u7edc\u8bf7\u6c42\uff0c\u7136\u540e\u5f97\u5230\u548c\u63d0\u53d6\u6570\u636e\u3002\r\n$ curl -i 127.0.0.1 # \u786e\u4fddNginx \u8fd0\u884c\uff0c\u9ed8\u8ba4\u76d1\u542c80\u7aef\u53e3\r\n\r\n# \u8bbe\u7f6eweb\u76ee\u5f55\u548ccache\u76ee\u5f55\r\n$ mkdir \/var\/www\r\n$ mkdir -p \/var\/cache\/nginx # -p \u53ef\u4ee5\u4e00\u4e0b\u5b50\u628a\u4e2d\u95f4\u8def\u5f84\u4e2d\u4e0d\u5b58\u5728\u7684\u6587\u4ef6\u5939\u4e5f\u4e00\u8d77\u5efa\u7acb\uff0c\u975e\u5e38\u5b9e\u7528\r\n$ chown www-data:www-data \/var\/www # nginx\u5b89\u88c5\u4f1a\u81ea\u52a8\u5efa\u7acb\u7528\u6237www-data\u5e76\u4e14\u9ed8\u8ba4\u7528\u8fd9\u4e2a\u7528\u6237\u64cd\u4f5c\r\n$ chown www-data:www-data \/var\/cache\/nginx\r\n\r\n# \u4fee\u6539\u914d\u7f6e\u6587\u4ef6(\u4e00\u822c\u4e0d\u64cd\u4f5c\u8fd9\u4e2a\u6587\u4ef6)\r\n$ cp \/etc\/nginx\/nginx.conf \/etc\/nginx\/nginx.conf.old # \u5907\u4efd\u539f\u6765\u914d\u7f6e\r\n$ vi \/etc\/nginx\/nginx.conf # \u53ef\u4ee5\u4fee\u6539\u9ed8\u8ba4\u7528\u6237\u4e3a\u5176\u4ed6\u7528\u6237\r\n\r\n# \u4e3aGhost\u5355\u72ec\u521b\u5efanginx\u914d\u7f6e\u6587\u4ef6\r\n$ rm \/etc\/nginx\/sites-enabled\/default # \u5220\u6389\u9ed8\u8ba4\u7684\u914d\u7f6e\r\n$ vi \/etc\/nginx\/sites-available\/mousycoder # \u5efa\u7acb\u4e00\u4e2anginx\u914d\u7f6e\u6587\u4ef6<\/pre>\n<p>&nbsp;<\/p>\n<div class=\"article fmt article__content\" data-id=\"1190000002947497\" data-license=\"cc\">\n<p>nginx\u914d\u7f6e\u6587\u4ef6<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">server {\r\n    listen 0.0.0.0:80; # \u76d1\u542c\u7684\u7aef\u53e3\u53f7\r\n    server_name mousycoder.com; # \u628amousycoder.com\u6362\u6210\u81ea\u5df1\u7684\u57df\u540d\uff0c\u5982\u679c\u6ca1\u6709\u57df\u540d\u6216\u8005\u7f51\u7ad9\u8fd8\u6ca1\u5907\u6848\u4e0b\u6765\u8fd9\u91cc\u53ef\u4ee5\u5199ip,\u4f8b\u5982120.25.150.209\uff0c\u5982\u679c\u914d\u7f6e\u591a\u4e2a\u7f51\u7ad9\u7684\u8bdd\uff0c\u8fd9\u91cc\u53ef\u4ee5\u901a\u8fc7\u4e0d\u540c\u7684\u7aef\u53e3\u5bf9\u5e94\u4e0d\u540c\u7684\u7f51\u7ad9\uff0c\u4f8b\u5982\uff1a120.25.150.209:81\u7b49 \u524d\u63d0\u662f\u8fd9\u4e9b\u7aef\u53e3\u5916\u7f51\u8fd8\u80fd\u8bbf\u95ee\u3002\r\n    access_log \/var\/log\/nginx\/mousycoder.log;\r\n\r\n    location \/ {\r\n        proxy_set_header Host $http_host;\r\n        proxy_set_header X-NginX-Proxy true;\r\n        proxy_set_header X-Real-IP $remote_addr;\r\n\r\n        proxy_pass http:\/\/127.0.0.1:2368;  # \u8fd9\u91cc\u662fGhost\u542f\u52a8\u65f6\u7684\u9ed8\u8ba4\u7aef\u53e3\uff0c\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u53d8\u5316\uff0c\u9ed8\u8ba4\u4e5f\u53ef\u4ee5\r\n        #proxy_buffering off;\r\n        proxy_redirect off;\r\n    }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<div class=\"article fmt article__content\" data-id=\"1190000002947497\" data-license=\"cc\">\n<p>\u7136\u540e\u91cd\u542f\u670d\u52a1<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ ln -s \/etc\/nginx\/sites-available\/mousycoder \/etc\/nginx\/sites-enabled\/mousycoder # \u5efa\u7acb\u8f6f\u94fe\u63a5\u5230\u5230\u5b9e\u9645\u914d\u7f6e\u8def\u5f84\uff0c\u65b9\u4fbf\u7edf\u4e00\u7ef4\u62a4\u914d\u7f6e\u6587\u4ef6\u53d8\u5316\u3002\r\n$ service nginx restart # nginx\u5b89\u88c5\u597d\u65f6\u5df2\u7ecf\u9ed8\u8ba4\u6ce8\u518c\u4e86\u7cfb\u7edf\u7684\u670d\u52a1\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u76f4\u63a5\u91cd\u542fnginx\u670d\u52a1\uff0c\u8ba9\u914d\u7f6e\u6587\u4ef6\u751f\u6548<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8865\u5145\u8bf4\u660e<\/p>\n<p>nginx \u8fd9\u91cc\u4e3b\u8981\u662f\u505a\u7aef\u53e3\u8f6c\u53d1\u6620\u5c04\u4f5c\u7528\uff0c\u5f53\u7136\u5b83\u975e\u5e38\u80fd\u6297\u538b\u3002<\/p>\n<h3 id=\"articleHeader7\">\u5b89\u88c5Node.Js<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ wget http:\/\/nodejs.org\/dist\/v0.10.39\/node-v0.10.39-linux-x64.tar.gz \r\n$ tar zxf node-v0.10.39-linux-x64.tar.gz &amp;&amp; cd node-v0.10.39-linux-x64\r\n$ cp bin\/* \/usr\/bin # \u62f7\u8d1d\u6267\u884c\u76ee\u5f55\uff0c\u76f8\u5f53\u4e8e\u53bb\u8bbe\u7f6e\u4e00\u4e2a\u73af\u5883\u53d8\u91cf\u5230\u7528\u6237\u7684bin\u76ee\u5f55<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8865\u5145\u8bf4\u660e<\/p>\n<p>\u8fd9\u91cc\u4e0b\u8f7d\u7684\u5e76\u4e0d\u662f\u6700\u65b0\u7248\u7684nodejs\uff0c\u4e3a\u4e86<strong>\u7a33\u5b9a<\/strong>\u3002<br \/>\nGhost\u5b98\u7f51\u89e3\u91ca<\/p>\n<p>\u4ece Ghost 0.6.0 \u7248\u672c\u5f00\u59cb\uff0cGhost \u4e2d\u6587\u7248\u5b8c\u6574\u5305\u5df2\u7ecf\u96c6\u6210\u4e86 Nodejs 0.12 \u7248\u672c\u7684 sqlite3 \u539f\u751f\u5e93\uff0c\u5728 windows\uff0832\/64 bit\uff09\u3001Linux\uff0832\/64 bit\uff09\u3001Mac\uff0864 bit\uff09\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u53ef\u4ee5\u76f4\u63a5\u5728 Nodejs 0.10.x \u548c 0.12.x \u7248\u672c\u4e0a\u8fd0\u884c\u3002\u4f46\u662f\uff0c\u6211\u4eec\u5f3a\u70c8\u5efa\u8bae\u4f7f\u7528 Node.js 0.10.x \u6700\u65b0\u7248\u672c\u3002\u5bf9 Node.js 0.12.x \u7248\u672c\u7684\u652f\u6301\u8fd8\u6709\u5f85\u8003\u9a8c\uff01<\/p>\n<p>\u8be6\u60c5\u89c1\u00a0<a href=\"http:\/\/www.ghostchina.com\/ghost-0-6-3-released\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">ghost\u4e2d\u6587\u7f51<\/a>\uff0c\u5f53\u7136NodeJs\u6709\u5f88\u591a\u79cd\u5b89\u88c5\u65b9\u6cd5\uff0c\u4e2a\u4eba\u89c9\u5f97\u8fd9\u79cd\u662f\u5728\u8fd9\u91cc\u6700\u9002\u5408\u7684\u65b9\u6cd5\u3002<\/p>\n<h3 id=\"articleHeader8\">\u5b89\u88c5Ghost<\/h3>\n<h4>\u4e0b\u8f7dGhost<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$cd \/var\/www\/\r\n$ curl -L http:\/\/dl.ghostchina.com\/Ghost-0.6.3-zh.zip -o mousycoder.zip\r\n$ unzip mousycoder.zip -d mousycoder\r\n$cd mousycoder\/<\/pre>\n<p>&nbsp;<\/p>\n<h4>\u914d\u7f6eGhost<\/h4>\n<p>Ghost\u6709\u4e24\u79cd\u8fd0\u884c\u6a21\u5f0f\uff1a\u5f00\u53d1\u6a21\u5f0f\u548c\u4ea7\u54c1\u6a21\u5f0f\uff0c\u901a\u8fc7config.js\u914d\u7f6e<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ cp config.example.js config.js\r\n$ vi config.js<\/pre>\n<div class=\"article fmt article__content\" data-id=\"1190000002947497\" data-license=\"cc\">\n<p>\u5728config.js\u914d\u7f6e\u6587\u4ef6\u91cc\u914d\u7f6e<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">- production # \u751f\u4ea7\u6a21\u5f0f\r\n    production:{\r\n       url: 'http:\/\/mousycoder.com',\r\n       main:{},\r\n       database:{\r\n           client :'mysql',\r\n           connection:{\r\n               host:'127.0.0.1',\r\n               user:'mousycoder',  # \u6570\u636e\u5e93\u8fde\u63a5\u7684\u7528\u6237\r\n               password:'123456',\r\n               database:'mousycoder',\r\n               charset:'utf-8'\r\n           }\r\n       }\r\n    }\r\n\r\n- development # \u5f00\u53d1\u6a21\u5f0f\r\n    production:{\r\n       url: 'http:\/\/mousycoder.com',\r\n       main:{},\r\n       database:{\r\n           client :'mysql',\r\n           connection:{\r\n               host:'127.0.0.1',\r\n               user:'mousycoder',  # \u6570\u636e\u5e93\u8fde\u63a5\u7684\u7528\u6237\r\n               password:'123456',\r\n               database:'mousycoderDev',\r\n               charset:'utf-8'\r\n           }\r\n       }\r\n    }<\/pre>\n<p>&nbsp;<\/p>\n<div class=\"article fmt article__content\" data-id=\"1190000002947497\" data-license=\"cc\">\n<h3 id=\"articleHeader9\">\u5b89\u88c5\u4e0e\u8fd0\u884c<\/h3>\n<p>\u6839\u636epackage.json \u5b89\u88c5\u4f9d\u8d56\u5305,\u8fdb\u5165\u5f53\u524dmousycoder\u76ee\u5f55\u4e0b<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$cd \/var\/www\/mousycoder\r\n$ npm install --production  # \u4ea7\u54c1\u6a21\u5f0f\uff1b\u53ea\u5b89\u88c5\u8fd0\u884c\u7684\u5305\r\n$ npm install # \u5f00\u53d1\u6a21\u5f0f\uff0c\u9ed8\u8ba4\u662f\u5f00\u53d1\u6a21\u5f0f<\/pre>\n<p>&nbsp;<\/p>\n<p>\u7528mousycoder\u8fd0\u884cGhost(\u975eroot\u8d26\u6237\u8fd0\u884cGhost\u66f4\u5b89\u5168)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ adduser -shell \/bin\/bash --gecos 'mousycoder blog' mousycoder\r\n$ chown -R mousycoder:mousycoder \/var\/www\/mousycoder<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5b89\u88c5forever,\u4fdd\u6301Ghost\u4e00\u76f4\u5728\u540e\u53f0\u8fd0\u884c<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$cd \/var\/www\/mousycoder\r\n$ npm install forever -g # \u5168\u5c40\u5b89\u88c5forever\u6a21\u5757\r\n$ NODE_ENV=production forever start index.js # \u751f\u4ea7\u6a21\u5f0f\u540e\u53f0\u8fd0\u884cghost<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5b89\u88c5\u7cfb\u7edf\u670d\u52a1<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ curl https:\/\/raw.githubusercontent.com\/TryGhost\/Ghost-Config\/master\/init.d\/ghost -o \/etc\/init.d\/mousycoder # \u4e0b\u8f7dGhost\u63d0\u4f9b\u7684\u811a\u672c\u5230\/etc\/init.d\/\u76ee\u5f55\uff0c\u8be5\u76ee\u5f55\u662f\u7cfb\u7edf\u670d\u52a1\u76ee\u5f55\r\n$ chmod +x \/etc\/init.d\/mousycoder # \u7ed9\u811a\u672c\u8d4b\u4e88\u6267\u884c\u6743\u9650\r\n$ usermod -aG mousycoder www-data # \u628awww-data\u7528\u6237\u52a0\u5165mousycoder\u7ec4\uff0c\u8ba9\u5176\u53ef\u4ee5\u64cd\u4f5c\u6e90\u6587\u4ef6\u7b49\u76ee\u5f55\r\n$ update-rc.d mousycoder defaults # \u7528update-rc.d \u5b89\u88c5\u670d\u52a1 mousycoder\r\n$ update-rc.d mousycoder enable # \u5237\u65b0\u4e00\u904d\u670d\u52a1,\u9632\u6b62\u4e4b\u524d\u6709\u91cd\u540d\u7684\r\n$ service mousycoder status # \u67e5\u770bmousycoder \u670d\u52a1\u7684\u72b6\u6001\r\n$ service mousycoder start # \u8fd9\u6837\u5f00\u673a\u5c31\u4f1a\u81ea\u52a8\u542f\u52a8ghost\u751f\u4ea7\u73af\u5883\uff0c\u4e0d\u4fe1reboot\u4e00\u4e0b<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8865\u5145\u8bf4\u660e<\/p>\n<ul>\n<li>curl \u5e38\u7528\u547d\u4ee4 \u8be6\u60c5\u53ef\u4ee5\u53c2\u8003<a href=\"http:\/\/www.ruanyifeng.com\/blog\/2011\/09\/curl.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u962e\u4e00\u5cf0<\/a>\u7684\u535a\u5ba2<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ curl -L https:\/\/raw.githubusercontent.com\/TryGhost\/Ghost-Config\/master\/init.d\/ghost -o ghost # -L \u89e3\u51b3\u7f51\u7ad9\u5730\u5740\u81ea\u52a8\u8df3\u8f6c\u540e\u62ff\u4e0d\u5230\u6587\u4ef6\r\n$ curl -v www.baidu.com  # \u663e\u793a\u8be6\u7ec6\u8fc7\u7a0b\u5305\u542bhttp\u5934\r\n$ curl -u username:password url \u89e3\u51b3\u9875\u9762\u9700\u8981\u6388\u6743\u8f93\u5165\u7528\u6237\u540d\u5bc6\u7801\u60c5\u51b5\r\n$ curl -u username --data \"param1=value1&amp;param2=value2\" https:\/\/api.github.com  # post\u8bf7\u6c42\r\n$ curl -I -X DELETE https:\/\/api.github.com  # \u89e3\u51b3get post\u4ee5\u5916\u7684\u8bf7\u6c42\u65b9\u5f0f\r\n$ curl --form \"fileupload=@filename.txt\" http:\/\/hostname\/resource  # \u4e0a\u4f20\u6587\u4ef6<\/pre>\n<p>&nbsp;<\/p>\n<ul>\n<li>chmod \u547d\u4ee4<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$\u00a0chmod\u00a0-R a-w abc\u00a0# \u53d6\u6d88\/abc\u76ee\u5f55\u7684-w\uff08\u5199\uff09\u6743\u9650<\/pre>\n<p>&nbsp;<\/p>\n<p>drwxr-xr-x \u7b2c\u4e00\u5217d \u76ee\u5f55 \u7b2c2-4\u5217 \u62e5\u6709\u8005\u6743\u9650 rwx 5-7\u5217 r-x\u540c\u7ec4\u7528\u6237\u6743\u9650 r-x\u662f\u5176\u4ed6\u7ec4\u7528\u6237\u6743\u9650,\u5176\u4e2drwx\u5bf9\u5e944,2,1<\/p>\n<ul>\n<li>\u7cfb\u7edf\u670d\u52a1\u542f\u52a8\u987a\u5e8f<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ update-rc.d A start 50 1 2 3 4 5 stop 51 0 6\r\n$ start 50 1 2 3 4 5 # \u8868\u793a\u57281,2,3,4,5\u8fd95\u4e2a\u8fd0\u884c\u7ea7\u522b\u4e2d\uff0c\u6309\u5148\u540e\u987a\u5e8f\uff0c\u7531\u5c0f\u5230\u5927\u6267\u884c\uff0c\u7b2c50\u4e2a\u5f00\u59cb\u8fd0\u884c\u811a\u672c\r\n$ stop 50 0 6 # \u8868\u793a\u57280\uff0c6\u8fd9\u4e24\u4e2a\u8fd0\u884c\u7ea7\u522b\u4e2d\uff0c\u6309\u7167\u5148\u540e\u987a\u5e8f\uff0c\u7531\u5c0f\u5230\u5230\u6267\u884c\uff0c\u7b2c52\u4e2a\u505c\u6b62\u8fd9\u4e2a\u811a\u672c\u8fd0\u884c\r\n$ update-rc.d mousycoder remove # \u5378\u8f7dmousycoder\u5f00\u673a\u670d\u52a1<\/pre>\n<p>&nbsp;<\/p>\n<h3 id=\"articleHeader10\">\u542f\u52a8<\/h3>\n<p>\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8f93\u5165\u4e4b\u524d\u914d\u7f6e\u7684ip\u6216\u8005\u57df\u540d<\/p>\n<p>\u9996\u9875\u00a0<a href=\"http:\/\/hostname.com\/ghost\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">http:\/\/hostname.com\/ghost<\/a><br \/>\nGhost\u540e\u53f0\u00a0<a href=\"http:\/\/hostname.com\/ghost\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">http:\/\/hostname.com\/ghost<\/a><\/p>\n<p>\u73b0\u5728\u4f60\u5c31\u53ef\u4ee5\u5c3d\u60c5\u4eab\u53d7Ghost\u5e26\u7ed9\u4f60\u7684\u6781\u81f4\u7b80\u6d01\u4e86\uff0c\u5feb\u6765\u4e66\u5199\u5427\uff01<\/p>\n<h2 id=\"articleHeader11\">\u4e3b\u9898<\/h2>\n<p><span class=\"img-wrap\"><img decoding=\"async\" title=\"\" src=\"http:\/\/ww4.sinaimg.cn\/large\/74311666jw1ex0g0kbnfhj20y20lkah6.jpg\" alt=\"\" data-src=\"http:\/\/ww4.sinaimg.cn\/large\/74311666jw1ex0g0kbnfhj20y20lkah6.jpg\" \/><\/span><\/p>\n<p><span class=\"img-wrap\"><img decoding=\"async\" title=\"\" src=\"http:\/\/ww4.sinaimg.cn\/large\/74311666jw1ex0fxvvaubj210q0ldn61.jpg\" alt=\"\" data-src=\"http:\/\/ww4.sinaimg.cn\/large\/74311666jw1ex0fxvvaubj210q0ldn61.jpg\" \/><\/span><\/p>\n<p><span class=\"img-wrap\"><img decoding=\"async\" title=\"\" src=\"http:\/\/ww3.sinaimg.cn\/large\/74311666jw1ex0fyx4780j212q0ob7aw.jpg\" alt=\"\" data-src=\"http:\/\/ww3.sinaimg.cn\/large\/74311666jw1ex0fyx4780j212q0ob7aw.jpg\" \/><\/span><\/p>\n<p>\u4e3b\u9898\u5730\u5740\uff1a<a href=\"https:\/\/github.com\/mousycoder\/mouse\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https:\/\/github.com\/mousycoder\/mouse<\/a><\/p>\n<p>\u6b22\u8fcefork<\/p>\n<h2 id=\"articleHeader12\">\u9644\u5f55<\/h2>\n<ul>\n<li><a href=\"https:\/\/highlightjs.org\/usage\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">HighLight\u4f7f\u7528\u6559\u7a0b<\/a><\/li>\n<\/ul>\n<hr \/>\n<p>\u611f\u8c22\u60a8\u7684\u8010\u5fc3\u9605\u8bfb\uff0c\u5982\u679c\u60a8\u53d1\u73b0\u6587\u7ae0\u4e2d\u6709\u4e00\u4e9b\u6ca1\u8868\u8ff0\u6e05\u695a\u7684\uff0c\u6216\u8005\u662f\u4e0d\u5bf9\u7684\u5730\u65b9\uff0c\u8bf7\u7ed9\u6211\u7559\u8a00\uff0c\u4f60\u7684\u9f13\u52b1\u662f\u4f5c\u8005\u5199\u4f5c\u6700\u5927\u7684\u52a8\u529b\uff0c<br \/>\n\u5982\u679c\u60a8\u8ba4\u4e3a\u672c\u6587\u8d28\u91cf\u4e0d\u9519\uff0c\u8bfb\u540e\u89c9\u5f97\u6536\u83b7\u5f88\u5927\uff0c\u4e0d\u59a8\u5c0f\u989d\u8d5e\u52a9\u6211\u4e00\u4e0b\uff0c\u8ba9\u6211\u66f4\u6709\u52a8\u529b\u7ee7\u7eed\u5199\u51fa\u9ad8\u8d28\u91cf\u7684\u6587\u7ae0\u3002<\/p>\n<ul>\n<li>\u652f\u4ed8\u5b9d<br \/>\n<span class=\"img-wrap\"><img decoding=\"async\" title=\"\" src=\"https:\/\/static.segmentfault.com\/v-5c8b4d77\/global\/img\/squares.svg\" alt=\"\" data-src=\"http:\/\/7xjl4u.com1.z0.glb.clouddn.com\/15-10-14\/18963137.jpg\" \/><\/span><\/li>\n<li>\u5fae\u4fe1<br \/>\n<span class=\"img-wrap\"><img decoding=\"async\" title=\"\" src=\"https:\/\/static.segmentfault.com\/v-5c8b4d77\/global\/img\/squares.svg\" alt=\"\" data-src=\"http:\/\/7xjl4u.com1.z0.glb.clouddn.com\/15-10-14\/34122370.jpg\" \/><\/span><\/li>\n<\/ul>\n<p>\u4f5c \u8005 :\u00a0<a href=\"http:\/\/weibo.com\/mousycoder\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@mousycoder<\/a><\/p>\n<p>\u539f\u6587\u51fa\u5904 :\u00a0<a href=\"http:\/\/mousycoder.com\/2015\/10\/12\/classic-tutorial-of-ghost-blog\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">http:\/\/mousycoder.com\/2015\/10\/12\/classic-tutorial-of-ghost-blog\/<\/a><\/p>\n<p>\u521b\u4f5c\u65f6\u95f4\uff1a2015-7-1<\/p>\n<p>\u66f4\u65b0\u65f6\u95f4\uff1a2015-10-14<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a041.9k \u6b21\u9605\u8bfb \u00a0\u00b7\u00a0 \u8bfb\u5b8c\u9700\u8981 <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[24],"tags":[121],"class_list":["post-3082","post","type-post","status-publish","format-standard","hentry","category-value_docs","tag-05-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=3082"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3082\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=3082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=3082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=3082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}