{"id":756,"date":"2022-06-28T11:43:00","date_gmt":"2022-06-28T03:43:00","guid":{"rendered":"http:\/\/www.rchen.top\/?p=756"},"modified":"2022-06-28T11:43:03","modified_gmt":"2022-06-28T03:43:03","slug":"wordpress%e9%83%a8%e7%bd%b2%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/www.rchen.top\/?p=756","title":{"rendered":"wordpress\u90e8\u7f72\u7b14\u8bb0"},"content":{"rendered":"<p><b>\u4e00\u3001\u8f6f\u4ef6\u4e0b\u8f7d\uff1a<\/b><\/p>\n<p>wordpress :<\/p>\n<p><a href=\"https:\/\/cn.wordpress.org\/download\/\">https:\/\/cn.wordpress.org\/download\/<\/a><\/p>\n<p><b>\u4e8c\u3001<\/b><b>\u73af\u5883<\/b><b>\u4ecb\u7ecd<\/b> <b>\uff1a<\/b><\/p>\n<p>Linux+Nginx+Mysql+php<\/p>\n<p>php-fpm : 7.4\u00a0 (\u7f16\u8bd1)<\/p>\n<p>mariadb:\uff08yum\u5b89\u88c5\uff09<\/p>\n<p>os : centos 7.6 (ps\uff1a\u91cd\u8981\uff01\uff01\uff01\uff01\u5173\u95ed\u5185\u6838\u9632\u706b\u5899\uff0c\u5426\u5219\u53ef\u80fd\u51fa\u73b0\u5404\u79cd\u6743\u9650\u5f02\u5e38\u95ee\u9898)<\/p>\n<p>nginx : 1.19.1 \uff08\u7f16\u8bd1\u5b89\u88c5\uff09<\/p>\n<p>\u4e09\u3001\u5b89\u88c5\u6570\u636e\u5e93\uff08\u7565\uff09<\/p>\n<p>\u521b\u5efa\u6570\u636e\u5e93\uff1awordpress<\/p>\n<p>\u521b\u5efa\u6570\u636e\u5e93\u8d26\u6237\uff1awordpressuser<\/p>\n<p>\u5bc6\u7801\uff1a \uff08\u5efa\u8bae\u8bbe\u590d\u6742\u70b9\uff09<\/p>\n<p>mysql&gt; use mysql;<\/p>\n<p>mysql&gt; create database wordpress character set utf8;<\/p>\n<p>mysql&gt; create user &#8216;wordpressuser&#8217;@&#8217;%&#8217; identified with mysql_native_password by &#8216;123456&#8217;;<\/p>\n<p>mysql&gt; Grant all privileges on wordpress.* to &#8216;wordpressuser&#8217;@&#8217;%&#8217;;<\/p>\n<p>mysql&gt; flush privileges;<\/p>\n<p>\u6ce8\uff1a\u5f53\u524dPHP\u7248\u672c\u4e2d\u6240\u5e26\u7684mysql\u65e0\u6cd5\u652f\u6301\u8fd9\u79cd\u5bc6\u7801\u9a8c\u8bc1\uff08caching_sha2_password\uff09\uff0c\u800cPHP\u9ed8\u8ba4\u7684\u662fmysql_native_password<\/p>\n<p>MySQL\u4e2d\u521b\u5efa\u4e00\u4e2a\u652f\u6301mysql_native_password\u9a8c\u8bc1\u7684\u7528\u6237\uff0c\u5e76\u7528\u8be5\u7528\u6237\u767b\u5f55\u7ba1\u7406wordpress\u6570\u636e\u5e93<\/p>\n<p>create user &#8216;wordpressuser&#8217;@&#8217;%&#8217; identified with mysql_native_password by &#8216;123456&#8217;;<\/p>\n<p><b>\u56db\u3001\u5b89\u88c5<\/b><b>php-fpm<\/b><b>\u73af\u5883\uff08\u7565\uff09<\/b><\/p>\n<p>\u53c2\u8003\u6587\u6863\uff1a\u300alinux\u4e0b\u7684php\u73af\u5883\u7f16\u8bd1\u5b89\u88c5\u300b<\/p>\n<p>\u542f\u52a8php \uff08\u9ed8\u8ba4\u8fd0\u884c\u5728tcp 9000\u7aef\u53e3\uff09<\/p>\n<p>\/usr\/local\/php\/sbin\/php-fpm<\/p>\n<p><b>\u4e94\u3001\u5b89\u88c5<\/b><b>nginx<\/b><b>\u53ca\u914d\u7f6e\u90e8\u5206<\/b><\/p>\n<p>nginx\u5b89\u88c5\uff08\u7565\uff09<\/p>\n<p>\u6ce8\u610f\uff1anginx.conf\u5185\u9700\u8981\u7f16\u8bd1php\u76f8\u5173\u914d\u7f6e<\/p>\n<p>\u4fee\u6539nginx.conf\u4e3b\u914d\u7f6e\uff0c\u4fee\u6539\u542f\u52a8\u8fdb\u7a0b\u7528\u6237\u4e3aphpuser<\/p>\n<p>vi nginx.conf<\/p>\n<p>user\u00a0 phpuser;<\/p>\n<p>\u5220\u9664\u9ed8\u8ba4\u7684.default.conf\uff0c\u65b0\u589e\u914d\u7f6e\uff0c<\/p>\n<p>vi \/etc\/nginx\/conf.d\/wordpress.conf<\/p>\n<p>server{<\/p>\n<p>listen 80;<\/p>\n<p>server_name\u00a0 localhost;<\/p>\n<p>root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/usr\/local\/wordpress;<\/p>\n<p>index index.php;<\/p>\n<p>location ~ \\.php$ {<\/p>\n<p>fastcgi_pass 127.0.0.1:9000;<\/p>\n<p>fastcgi_index index.php;<\/p>\n<p>fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<\/p>\n<p>include fastcgi_params;<\/p>\n<p>}<\/p>\n<p>error_page\u00a0\u00a0 500 502 503 504\u00a0 \/50x.html;<\/p>\n<p>location = \/50x.html {<\/p>\n<p>root\u00a0\u00a0 \/usr\/share\/nginx\/html;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>\u516d\u3001\u4e0a\u4f20wordpress\u5e76\u89e3\u538b\u81f3wordpress\u76ee\u5f55\u4e0b\/usr\/local\/wordpress<\/p>\n<p>\u53ef\u4ee5\u5728\u76ee\u6807\u6587\u4ef6\u5939\u4e0b\u521b\u5efa\u4e00\u4e2aphp\u6d4b\u8bd5\u80fd\u5426\u6253\u5f00<\/p>\n<p>vi \/usr\/local\/wordpress\/test2.php<\/p>\n<p>&lt;?php echo &#8220;hello world&#8221;; ?&gt;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"517\" height=\"113\" class=\"alignnone wp-image-758 size-full\" src=\"http:\/\/www.rchen.top\/wp-content\/uploads\/2022\/06\/Pasted-58.png\" \/><\/p>\n<p>\u4e03\u3001\u914d\u7f6ewp-config.php\uff0c<\/p>\n<p>cp wp-config-sample.php\u00a0 wp-config.php<\/p>\n<p>vi wp-config.php<\/p>\n<p>###\u7f16\u8f91wp-config.php<\/p>\n<p>define( &#8216;DB_NAME&#8217;, &#8216;wordpress&#8217; );<\/p>\n<p>\/** MySQL database username *\/<\/p>\n<p>define( &#8216;DB_USER&#8217;, &#8216;wordpressuser&#8217; );<\/p>\n<p>\/** MySQL database password *\/<\/p>\n<p>define( &#8216;DB_PASSWORD&#8217;, &#8216;123456&#8217; );<\/p>\n<p>\/** MySQL hostname *\/<\/p>\n<p>define( &#8216;DB_HOST&#8217;, &#8216;localhost&#8217; );<\/p>\n<p>\/** Database Charset to use in creating database tables. *\/<\/p>\n<p>define( &#8216;DB_CHARSET&#8217;, &#8216;utf8&#8217; );<\/p>\n<p>\/** The Database Collate type. Don&#8217;t change this if in doubt. *\/<\/p>\n<p>define( &#8216;DB_COLLATE&#8217;, &#8221; );<\/p>\n<p>###\u5728\u6587\u4ef6\u7684\u6700\u540e\u6dfb\u52a0\u8fd9\u4e48\u4e00\u53e5\u8bdd\uff1a\u9875\u9762\u4e0a\u64cd\u4f5c\u52a0\u8f7d\u63d2\u4ef6\u7684\u65f6\u5019\u5c31\u4e0d\u9700\u8981\u518d\u8f93\u5165FTP\u8d26\u6237\u5bc6\u7801<\/p>\n<p>define(&#8216;FS_METHOD&#8217;, &#8220;direct&#8221;);<\/p>\n<p>\u516b\u3001\u5f00\u59cb\u90e8\u7f72<\/p>\n<p>\u786e\u8ba4\u5f00\u542f\u8fd9\u4e09\u4e2a\u670d\u52a1<\/p>\n<p>nginx<\/p>\n<p>php-fpm<\/p>\n<p>mysql<\/p>\n<p>\u8bbf\u95ee\uff1a<\/p>\n<p><a href=\"http:\/\/ip\/index.php\">http:\/\/ip\/index.php<\/a><\/p>\n<p>PS: \u6570\u636e\u5e93\u8fc1\u79fb\u6ce8\u610f\u66ff\u6362sql\u5185\u7684\u5730\u5740\u6216\u57df\u540d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u8f6f\u4ef6\u4e0b\u8f7d\uff1a wordpress : https:\/\/cn.wordpress.org\/download\/  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":759,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[95],"tags":[140],"class_list":["post-756","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-95","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=756"}],"version-history":[{"count":1,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/756\/revisions"}],"predecessor-version":[{"id":760,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/756\/revisions\/760"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/media\/759"}],"wp:attachment":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}