{"id":428,"date":"2024-08-20T17:33:22","date_gmt":"2024-08-20T09:33:22","guid":{"rendered":"http:\/\/8.154.33.202\/?p=428"},"modified":"2024-08-20T17:46:57","modified_gmt":"2024-08-20T09:46:57","slug":"ubuntu-22-04-%e5%ae%89%e8%a3%85wordpress-%e6%90%ad%e5%bb%ba%e5%8d%9a%e5%ae%a2%e7%bd%91%e7%ab%99","status":"publish","type":"post","link":"http:\/\/8.154.33.202\/?p=428","title":{"rendered":"ubuntu 22.04 \u5b89\u88c5wordpress \u642d\u5efa\u535a\u5ba2\u7f51\u7ad9"},"content":{"rendered":"\n<p><strong>\u603b\u4f53\u4ecb\u7ecd<\/strong><\/p>\n\n\n\n<p>Apache \u4f5c\u4e3a Web \u670d\u52a1\u5668\u63a5\u6536\u7528\u6237\u8bf7\u6c42\u5e76\u8fd4\u56de\u7f51\u9875\u5185\u5bb9\uff1bMySQL \u4f5c\u4e3a\u6570\u636e\u5e93\u5b58\u50a8\u7f51\u7ad9\u6570\u636e\uff1bPHP \u4f5c\u4e3a\u811a\u672c\u8bed\u8a00\u5728\u670d\u52a1\u5668\u7aef\u5904\u7406\u8bf7\u6c42\u5e76\u4e0e MySQL \u4ea4\u4e92\u751f\u6210\u52a8\u6001\u5185\u5bb9\uff1bWordPress \u5219\u662f\u57fa\u4e8e PHP \u548c MySQL \u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u65b9\u4fbf\u7684\u7f51\u7ad9\u521b\u5efa\u548c\u7ba1\u7406\u5e73\u53f0\u3002<br><br><strong>\u5b89\u88c5apache\u3001mariadb\u548cphp<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\napt install apache2 mariadb-server libapache2-mod-php php-gd php-mysql\napt install php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip php-json<\/code><\/pre>\n\n\n\n<p><strong>\u914d\u7f6e\u6570\u636e\u5e93<\/strong><\/p>\n\n\n\n<p>\u4e3aWordPress\u521d\u59cb\u5316\u6570\u636e\u5e93MariaDB<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql_secure_installation<\/code><\/pre>\n\n\n\n<p>\u521d\u59cb\u5316MariaDB\u8bbe\u7f6e\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Set root password? &#91;Y\/n] n\nRemove anonymous users? &#91;Y\/n] y\nDisallow root login remotely? &#91;Y\/n] y\nRemove test database and access to it? &#91;Y\/n] y\nReload privilege tables now? &#91;Y\/n] y<\/code><\/pre>\n\n\n\n<p>\u767b\u5f55\u5230MariaDB\u63a7\u5236\u53f0\u5e76\u4e3aWordPress\u521b\u5efa\u6570\u636e\u5e93\u3002\u5b89\u88c5phpmyadmin<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install phpmyadmin<\/code><\/pre>\n\n\n\n<p>\u4e3aMySQL\u7528\u6237\u914d\u7f6e\u5bc6\u7801\u8bbf\u95ee<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p<\/code><\/pre>\n\n\n\n<p>\u5728mysql\u547d\u4ee4\u884c\u4e2d\uff0c\u6267\u884c\u4ee5\u4e0b\u6307\u4ee4\uff0c\u6ce8\u610f\u4e0d\u8981\u6f0f\u6389\u6700\u540e\u7684\u5206\u53f7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'wpsql'@'localhost' IDENTIFIED BY '\u4f60\u7684\u5bc6\u7801';\nGRANT ALL PRIVILEGES ON *.* TO 'wpsql'@'localhost' WITH GRANT OPTION;\nexit<\/code><\/pre>\n\n\n\n<p><strong>\u5b89\u88c5wordpress<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/wordpress.org\/latest.tar.gz\ntar -xzvf latest.tar.gz\nsudo mv wordpress\/* \/var\/www\/html\/\nchown -R www-data:www-data \/var\/www\/html\nmv \/var\/www\/html\/index.html \/var\/www\/html\/index~.html<\/code><\/pre>\n\n\n\n<p><strong>\u521b\u5efa\u6570\u636e\u5e93\u548c\u83b7\u53d6\u6570\u636e\u5e93\u5bc6\u94a5<\/strong><\/p>\n\n\n\n<p>\u6d4f\u89c8\u5668\u6253\u5f00\uff1aip\u5730\u5740\/phpmyadmin\uff0c\u767b\u9646phpmyadmin\uff0c\u7528\u6237\u540d\uff1awpsql   \u5bc6\u7801\uff1awpsql\u5bc6\u7801<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"704\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-1024x704.png\" alt=\"\" class=\"wp-image-436\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-1024x704.png 1024w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-300x206.png 300w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-768x528.png 768w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image.png 1143w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u521b\u5efawordpress\u6570\u636e\u5e93<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"618\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-1-1024x618.png\" alt=\"\" class=\"wp-image-437\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-1-1024x618.png 1024w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-1-300x181.png 300w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-1-768x464.png 768w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-1-1536x928.png 1536w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-1.png 1651w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u521b\u5efa\u6570\u636e\u5e93\u8d26\u53f7<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"725\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-2-1024x725.png\" alt=\"\" class=\"wp-image-438\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-2-1024x725.png 1024w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-2-300x212.png 300w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-2-768x544.png 768w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-2-1536x1088.png 1536w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-2.png 1936w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u6570\u636e\u5e93\u540d\uff1awpadmin<br>\u6570\u636e\u5e93\u5bc6\u7801:\u201c\u8bbe\u7f6e\u7528\u6237\u5bc6\u7801\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"488\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-3-1024x488.png\" alt=\"\" class=\"wp-image-440\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-3-1024x488.png 1024w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-3-300x143.png 300w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-3-768x366.png 768w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-3-1536x731.png 1536w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-3.png 1615w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u6ce8\u610f\u8fd9\u91cc\u751f\u6210\u7684\u5bc6\u94a5\uff1awOSeiA]xOKa0c[c1\uff0c\u8981\u8bb0\u4f4f\uff0c\u5f53\u7136\u540e\u9762\u8fd8\u53ef\u4ee5\u6539\uff0c\u8fd9\u662fwordpress\u53ef\u767b\u5f55sql\u7684\u5bc6\u94a5\uff0c\u5e76\u4e0d\u662f\u4f60\u8bbe\u7f6e\u7684\u90a3\u4e2a\u5bc6\u7801<\/p>\n\n\n\n<p>\u5c06\u8be5\u7528\u6237\u9644\u4e88\u6570\u636e\u5e93wordpress\uff0c\u9009\u4e2d\u521b\u5efa\u7684wpadmin\u8d26\u6237<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"913\" height=\"430\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-4.png\" alt=\"\" class=\"wp-image-441\" style=\"width:674px;height:auto\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-4.png 913w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-4-300x141.png 300w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-4-768x362.png 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u9009\u62e9\u6570\u636e\u5e93wordpress<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"510\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-5-1024x510.png\" alt=\"\" class=\"wp-image-442\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-5-1024x510.png 1024w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-5-300x150.png 300w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-5-768x383.png 768w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-5-1536x766.png 1536w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-5.png 1687w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u6743\u9650\u5168\u90e8\u90fd\u8981\u9009\u4e0a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"771\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-6-1024x771.png\" alt=\"\" class=\"wp-image-443\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-6-1024x771.png 1024w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-6-300x226.png 300w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-6-768x578.png 768w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-6-1536x1157.png 1536w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-6.png 1690w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><strong>WordPress\u7f51\u7ad9\u914d\u7f6e<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/var\/www\/html<br>cp wp-config-sample.php wp-config.php<br>vim wp-config.php<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"1024\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-7-956x1024.png\" alt=\"\" class=\"wp-image-444\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-7-956x1024.png 956w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-7-280x300.png 280w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-7-768x823.png 768w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-7.png 1320w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u5728Database password\u90a3\u91cc\u628a\u4e0a\u8fb9\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u5bc6\u94a5\u586b\u5230\u8fd9\u91cc\uff0c\u6ce8\u610f\u8fd9\u91cc\u5e76\u4e0d\u662f\u586b\u4f60\u8bbe\u7f6e\u7684\u5bc6\u7801\u3002\u7136\u540e\u91cd\u542fapache<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\uff0c\u5c31\u53ef\u4ee5\u4ece\u6d4f\u89c8\u5668\u6253\u5f00ip\u5730\u5740\u6765\u767b\u9646wordpress\u4e86\uff0c\u9996\u6b21\u767b\u9646\u4f1a\u8981\u6c42\u8bbe\u7f6e\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n\n\n\n<p><strong>\u5176\u4ed6\u95ee\u9898\u8ba8\u8bba<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1\u3001WordPress\u5b89\u88c5\u4e3b\u9898\u3001\u63d2\u4ef6\u3001\u66f4\u65b0\u65f6\u9700\u8981FTP\u7684\u89e3\u51b3\u529e\u6cd5<\/li>\n<\/ul>\n\n\n\n<p>\u4fee\u6539wp-config.php\u6587\u4ef6vim \/var\/www\/html\/wp-config.php\u3002\u5bf9\u4e8e\u6ca1\u6709\u670d\u52a1\u5668\u76ee\u5f55\u64cd\u4f5c\u6743\u9650\u7684\u7528\u6237\u6765\u8bf4\uff0c\u4fee\u6539wp-config.php\u6587\u4ef6\u4f1a\u6bd4\u8f83\u7b80\u5355\u5feb\u6377\uff0c\u53ea\u9700\u8981\u5728wp-config.php\u7684\u6587\u4ef6\u4e2d\uff0cdefine( &#8216;WP_DEBUG&#8217;, false );\u4e0b\u9762\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('FS_METHOD','direct');<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"998\" height=\"1024\" src=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-8-998x1024.png\" alt=\"\" class=\"wp-image-445\" srcset=\"http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-8-998x1024.png 998w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-8-292x300.png 292w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-8-768x788.png 768w, http:\/\/8.154.33.202\/wp-content\/uploads\/2024\/08\/image-8.png 1129w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>2\u3001WordPress\u89e3\u51b3\u6587\u4ef6\u5927\u5c0f\u4e0a\u4f202M\u9650\u5236\u65b9\u6cd5<\/li>\n<\/ul>\n\n\n\n<p>\u5728 WordPress \u4e2d\u9ed8\u8ba4\u7684\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f\u9650\u5236\u53ef\u80fd\u4f1a\u6bd4\u8f83\u5c0f\uff0c\u5f00\u59cb\u4e3a2M\uff0c\u8981\u5c06\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f\u9650\u5236\u589e\u52a0\uff0c\u53ef\u4ee5\u901a\u8fc7<strong>\u4fee\u6539 php.ini \u6587\u4ef6<\/strong>\u5b9e\u73b0\u3002\u627e\u5230\u5e76\u6253\u5f00\u00a0<code>php.ini<\/code>\u00a0\u6587\u4ef6\uff1a<code>php.ini<\/code>\u00a0\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u80fd\u5728\u00a0<code>\/etc\/php\/[php \u7248\u672c\u53f7]\/apache2\/php.ini<\/code>\u00a0\u6216\u00a0<code>\/etc\/php\/[php \u7248\u672c\u53f7]\/cli\/php.ini<\/code>\u3002\u4f7f\u7528vim\u7b49\u4fee\u6539\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n\n\n\n<p><code>upload_max_filesize<\/code>: \u8bbe\u7f6e\u5141\u8bb8\u4e0a\u4f20\u7684\u6700\u5927\u6587\u4ef6\u5927\u5c0f\uff0c\u4f8b\u5982\u5c06\u5176\u8bbe\u7f6e\u4e3a&nbsp;<code>200M<\/code>\u3002<\/p>\n\n\n\n<p><code>post_max_size<\/code>: \u8bbe\u7f6e POST \u8bf7\u6c42\u5141\u8bb8\u7684\u6700\u5927\u5927\u5c0f\uff0c\u8fd9\u4e2a\u503c\u901a\u5e38\u5e94\u8be5\u6bd4&nbsp;<code>upload_max_filesize<\/code>&nbsp;\u7a0d\u5927\u4e00\u4e9b\uff0c\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u4e3a&nbsp;<code>200M<\/code>\u3002<\/p>\n\n\n\n<p>\u91cd\u542fapache<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u603b\u4f53\u4ecb\u7ecd Apache \u4f5c\u4e3a Web \u670d\u52a1\u5668\u63a5\u6536\u7528\u6237\u8bf7\u6c42\u5e76\u8fd4\u56de\u7f51\u9875\u5185\u5bb9\uff1bMySQL \u4f5c\u4e3a\u6570\u636e\u5e93\u5b58\u50a8\u7f51\u7ad9\u6570\u636e\uff1bP &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/8.154.33.202\/?p=428\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cubuntu 22.04 \u5b89\u88c5wordpress \u642d\u5efa\u535a\u5ba2\u7f51\u7ad9\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-428","post","type-post","status-publish","format-standard","hentry","category-14"],"_links":{"self":[{"href":"http:\/\/8.154.33.202\/index.php?rest_route=\/wp\/v2\/posts\/428"}],"collection":[{"href":"http:\/\/8.154.33.202\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/8.154.33.202\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/8.154.33.202\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/8.154.33.202\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=428"}],"version-history":[{"count":7,"href":"http:\/\/8.154.33.202\/index.php?rest_route=\/wp\/v2\/posts\/428\/revisions"}],"predecessor-version":[{"id":451,"href":"http:\/\/8.154.33.202\/index.php?rest_route=\/wp\/v2\/posts\/428\/revisions\/451"}],"wp:attachment":[{"href":"http:\/\/8.154.33.202\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/8.154.33.202\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=428"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/8.154.33.202\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}