{"id":851,"date":"2020-09-08T23:27:11","date_gmt":"2020-09-08T15:27:11","guid":{"rendered":"https:\/\/www.iotch.xyz\/?p=851"},"modified":"2020-09-08T23:27:11","modified_gmt":"2020-09-08T15:27:11","slug":"typecho%e4%b8%8a%e6%89%8b%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.iotch.xyz\/?p=851","title":{"rendered":"Typecho\u4e0a\u624b\u6307\u5357"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"h1_1\">\u524d\u8a00<\/h1>\n\n\n\n<p>\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u642d\u5efa\u57fa\u4e8e<strong>Typecho<\/strong>\u7684\u4e2a\u4eba\u7f51\u7ad9\uff0c\u4ee5\u53ca\u5206\u4eab\u4e00\u4e9b\u9047\u5230\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"h1_2\">Why Typecho<\/h1>\n\n\n\n<p><strong>Typecho<\/strong>\u662f\u4e00\u4e2a\u7531\u56fd\u4eba\u5f00\u53d1\u7684<em>\u8f7b\u91cf\u7ea7CMS<\/em>\uff0c\u548c<strong>WordPress<\/strong>\u4e00\u6837\uff0c\u53ef\u4ee5\u5feb\u901f\u5efa\u7acb\u4e2a\u4eba\u535a\u5ba2\u7f51\u7ad9\u3002So <strong>Why Typecho<\/strong>\uff1f <strong>WordPress<\/strong>\u6709\u65e0\u6570\u7684\u4f18\u70b9\uff0c\u4f46\u662f\u9009\u62e9<strong>Typecho<\/strong>\u7684\u7406\u7531\u53ea\u9700\u4e00\u4e2a\uff1a<strong>\u7b80\u5355<\/strong>\uff0c<strong>\u7b80\u6d01<\/strong>\uff0c<strong>\u8f7b\u91cf\u7ea7<\/strong>\u3002 <strong>Typecho<\/strong>\u51e0\u4e4e\u662f\u4e13\u95e8\u4e3a\u4e2a\u4eba\u535a\u5ba2\u6253\u9020\u7684\uff0c\u5168\u90e8\u4ee3\u7801\u4e0d\u8db3400KB\uff0c\u4e5f\u4e0d\u50cf<strong>WordPress<\/strong>\u4e00\u6837\u5bf9\u4e3b\u673a\u6027\u80fd\u6709\u4e00\u5b9a\u7684\u8981\u6c42\u3002\u754c\u9762\u548c\u63a7\u5236\u53f0\u90fd\u662f\u6781\u7b80\u98ce\uff0c\u975e\u5e38\u6e05\u723d\uff0c\u5f88\u5bb9\u6613\u4e0a\u624b\u3002\u5bf9<strong>MarkDown<\/strong>\u652f\u6301\u975e\u5e38\u53cb\u597d\uff0c\u4e0d\u9700\u8981\u989d\u5916\u7684\u63d2\u4ef6\u3002 <img decoding=\"async\" src=\"https:\/\/oscimg.oschina.net\/oscnet\/up-7d0e33d6e8e42e1d183e3565d97e0f87826.png\" alt=\"Typecho Console\"><\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"h1_3\">\u73af\u5883<\/h1>\n\n\n\n<p><strong>Typecho<\/strong>\u7684\u63a8\u8350\u73af\u5883\u662f<strong>LNMP(Linux, Nginx, MySQL, PHP)<\/strong>\uff0c\u8ddf<strong>WordPress<\/strong>\u975e\u5e38\u76f8\u4f3c\uff0c\u53ef\u4ee5\u5171\u7528\u3002 \u56e0\u4e3a\u672c\u4eba\u4e4b\u524d\u5199\u8fc7\u5728<strong>Ubuntu<\/strong>\u4e0a\u642d\u5efa<strong>WordPress<\/strong>\u73af\u5883\u7684\u6b65\u9aa4\uff0c\u4e3a\u907f\u514d\u91cd\u590d\u9020\u8f6e\uff0c<strong>Linux<\/strong>\uff0c<strong>MySQL<\/strong>\uff0c<strong>PHP7<\/strong>\u7684\u90e8\u5206\u53ef\u4ee5\u53c2\u8003<a href=\"https:\/\/nightfield.com.cn\/index.php\/archives\/5\/\" target=\"_blank\"  rel=\"nofollow\" >\u8fd9\u91cc<\/a>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_4\">Nginx<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_5\">\u5b89\u88c5Nginx<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install nginx\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_6\">\u9a8c\u8bc1Nginx<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status nginx\n<\/code><\/pre>\n\n\n\n<p>\u4f1a\u5f97\u5230\u5982\u4e0b\u8f93\u51fa<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u25cf nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2019-12-05 10:19:16 CST; 4h 29min ago Process: 80264 ExecStop=\/sbin\/start-stop-daemon --quiet --stop --retry QUIT\/5 --pidfile \/run\/nginx.pid (code=exited, status=0\/SUCCESS) Process: 80384 ExecStart=\/usr\/sbin\/nginx -g daemon on; master_process on; (code=exited, status=0\/SUCCESS) Process: 80380 ExecStartPre=\/usr\/sbin\/nginx -t -q -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_7\">\u542f\u52a8Nginx<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start nginx\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h4_8\">\u4fee\u6539Nginx\u914d\u7f6e<\/h4>\n\n\n\n<p>Nginx\u9ed8\u8ba4\u5b89\u88c5\u5728 <em>\/etc\/nginx\/\u76ee\u5f55\u4e0b\uff0c\u5728\u6b64\u76ee\u5f55\u4e0b\u627e\u5230\u9ed8\u8ba4\u7684\u914d\u7f6e\u6587\u4ef6sites-enabled\/default<\/em>(\u4e0d\u540c\u7684Nginx\u7248\u672c\u6216\u8005\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6\u4f1a\u6709\u533a\u522b)\uff0c\u628a<strong>index.php<\/strong>\u52a0\u5230<em>index<\/em>\u6807\u7b7e\u4e0b\uff0c\u540c\u65f6\u5c06<strong>PHP<\/strong>\u5bf9\u5e94\u7684location\u6253\u5f00<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>index **index.php** index.html;\n\nlocation ~ \\.php$ { \n    include snippets\/fastcgi-php.conf;\n    fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\n}\n<\/code><\/pre>\n\n\n\n<p>\u8981\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86<strong>php-fpm<\/strong>\uff0c\u5426\u5219Nginx\u65e0\u6cd5\u6b63\u5e38\u7ed9php\u505a\u8f6c\u53d1\u3002\u5982\u679c\u8fd8\u6ca1\u6709\u5b89\u88c5\uff0c\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php-fpm php-mysql\n<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"h1_9\">\u5b89\u88c5Typecho<\/h1>\n\n\n\n<p>\u76f4\u63a5\u4ece\u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7684\u7248\u672c\uff0c\u89e3\u538b\u5230Nginx\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/share\/nginx\nsudo wget http:\/\/typecho.org\/downloads\/1.1-17.10.30-release.tar.gz\ntar -zxvf 1.1-17.10.30-release.tar.gz\ncp .\/build\/* .\/html\/\n<\/code><\/pre>\n\n\n\n<p>\u4e0d\u8981\u5fd8\u4e86\u4fee\u6539\u4e00\u4e0bNginx\u53d1\u5e03\u76ee\u5f55\u7684\u6743\u9650<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/share\/nginx\/html\nchmod -R 755 *\nchown {owner}\/{group} *\n<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u662fUbuntu\uff0cowner\u548cgroup\u90fd\u662f<strong>www-data<\/strong>\uff0c\u5982\u679c\u662fCentOS\u5219\u4e8b<strong>nginx<\/strong>\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u7528\u6237<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ps -ef | grep nginx\n<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"h1_10\">\u9a8c\u8bc1Typecho<\/h1>\n\n\n\n<p>\u73b0\u5728\u6d4f\u89c8\u5668\u6253\u5f00 <em>{ip}:80<\/em>(nginx\u9ed8\u8ba480\u7aef\u53e3)\uff0c\u53ef\u4ee5\u770b\u5230<strong>Typecho<\/strong>\u7684\u6b22\u8fce\u9875\u9762 <img decoding=\"async\" src=\"https:\/\/oscimg.oschina.net\/oscnet\/up-a38695234ed8b738d87228f39c6941cd0c1.png\" alt=\"Typecho Welcome\"><\/p>\n\n\n\n<p>\u6309\u7167\u5411\u5bfc\u4e00\u6b65\u4e00\u6b65\u8d70\u4e0b\u6765\uff0c\u53ef\u4ee5\u770b\u5230\u7b80\u6d01\u6e05\u723d\u7684\u535a\u5ba2\u754c\u9762 <img decoding=\"async\" src=\"https:\/\/oscimg.oschina.net\/oscnet\/up-8532711eb471665f243b2e132426d7030ce.png\" alt=\"First Blog\"><\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"h1_11\">PHP7\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_12\">502 bad gateway<\/h2>\n\n\n\n<p>\u5982\u679c\u6253\u5f00\u9875\u9762\u62a5<em>502 bad gateway<\/em>\uff0c\u662f\u56e0\u4e3axml\u89e3\u6790\u4e0d\u517c\u5bb9\u9020\u6210\u7684\uff0c\u5b89\u88c5<strong>php7.0-xml<\/strong>\u5373\u53ef\u89e3\u51b3\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ubuntu<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install php7.0-xml\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>CentOS<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install php7.0-xml\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_13\">404 not found<\/h2>\n\n\n\n<p>\u5982\u679c\u6253\u5f00\u4efb\u4f55<strong>Typecho<\/strong>\u5b50\u9875\u9762\u90fd\u62a5<em>404 not found<\/em>\uff0c\u9700\u8981\u5728nginx\u7684\u914d\u7f6e\u6587\u4ef6\u6dfb\u52a0\u5982\u4e0b\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location \/ {\n    if (-f $request_filename\/index.html){\n        rewrite (.*) $1\/index.html break;\n    }\n    if (-f $request_filename\/index.php){\n        rewrite (.*) $1\/index.php;\n    }\n    if (!-f $request_filename){\n        rewrite (.*) \/index.php;\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u5728<strong>php<\/strong>\u7684location\u4e0b\u6dfb\u52a0\u53c2\u6570<strong>fastcgi_split_path_info ^(.+.php)(\/.+)$;<\/strong>\uff0c\u53c2\u8003\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n\tlisten 80 default_server;\n\tlisten &#91;::]:80 default_server;\n\n\troot \/usr\/share\/nginx\/typecho;\n\n\tindex index.php index.html;\n\n\tserver_name localhost;\n\n\tlocation \/ {\n\t\t# First attempt to serve request as file, then\n\t\t# as directory, then fall back to displaying a 404.\n\t\tif (-f $request_filename\/index.html){\n\t\t\trewrite (.*) $1\/index.html break;\n\t\t}\n\t\tif (-f $request_filename\/index.php){\n\t\t\trewrite (.*) $1\/index.php;\n\t\t}\n\t\tif (!-f $request_filename){\n\t\t\trewrite (.*) \/index.php;\n\t\t}\n\t\ttry_files $uri $uri\/ =404;\n\t}\n\n\t# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n\t#\n\tlocation ~ \\.php$ {\n\t\tinclude snippets\/fastcgi-php.conf;\n\t\tfastcgi_split_path_info ^(.+\\.php)(\/.+)$;\n\t\t# With php7.0-cgi alone:\n\t\t# fastcgi_pass 127.0.0.1:9000;\n\t\t# With php7.0-fpm:\n\t\tfastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\n\t}\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_14\">\u4ece<strong>WordPress<\/strong>\u8fc1\u79fb\u5230<strong>Typecho<\/strong><\/h2>\n\n\n\n<p><strong>Typecho<\/strong>\u6709<a href=\"http:\/\/docs.typecho.org\/plugins\/wordpress-to-typecho\" target=\"_blank\"  rel=\"nofollow\" >\u63d2\u4ef6<\/a>\u652f\u6301\u4ece<strong>WordPress<\/strong>\u8f6c\u79fb\u6587\u7ae0\uff0c\u4f46\u662f\u5efa\u8bae\u5b89\u88c5\u8001\u7248\u672c\u7684<strong>Typecho<\/strong>\u73af\u5883\uff0c\u800c\u4e14\u5bf9<strong>WordPress<\/strong>\u7684\u7248\u672c\u6709\u8981\u6c42\uff0c\u81f3\u5c11\u535a\u4e3b\u5728<strong>WordPress5<\/strong>\u548c<strong>Typecho1.1<\/strong>\u4e0b\u6ca1\u6709\u8fc1\u79fb\u6210\u529f\u3002\u6240\u4ee5\u5efa\u8bae\u4e0d\u8981\u8fc1\u79fb\u54c8\u54c8\u54c8\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"h1_15\">\u603b\u7ed3<\/h1>\n\n\n\n<p><strong>Typecho<\/strong>\u73af\u5883\u7684\u642d\u5efa\u4e0e<strong>WordPress<\/strong>\u975e\u5e38\u76f8\u4f3c\uff0c\u5982\u679c\u4f60\u662f\u60f3\u8981\u4e00\u4e2a<strong>\u7eaf\u7cb9\u6781\u7b80<\/strong>\u535a\u6587\u7f51\u7ad9\uff0c\u5e76\u4e60\u60ef<strong>MarkDown<\/strong>\u5199\u6587\uff0c\u90a3\u5c31\u611f\u89c9\u4e0a\u624b<strong>Typecho<\/strong>\u5427\uff0c\u4f60\u503c\u5f97\u62e5\u6709\u3002<\/p>\n\n\n\n<p>\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/my.oschina.net\/u\/2411391\/blog\/3137889\" target=\"_blank\" rel=\"noreferrer noopener\" rel=\"nofollow\" >https:\/\/my.oschina.net\/u\/2411391\/blog\/3137889<\/a><\/p>\n<button class=\"simplefavorite-button\" data-postid=\"851\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u642d\u5efa\u57fa\u4e8eTypecho\u7684\u4e2a\u4eba\u7f51\u7ad9\uff0c\u4ee5\u53ca\u5206\u4eab\u4e00\u4e9b\u9047\u5230\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\u3002 Why Typecho Typecho\u662f\u4e00 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-851","post","type-post","status-publish","format-standard","hentry","category-10"],"_links":{"self":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts\/851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=851"}],"version-history":[{"count":0,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=\/wp\/v2\/posts\/851\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iotch.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}