{"id":118,"date":"2023-08-13T22:28:49","date_gmt":"2023-08-13T14:28:49","guid":{"rendered":"http:\/\/8.130.131.184\/wordpress\/?p=118"},"modified":"2023-08-31T10:42:51","modified_gmt":"2023-08-31T02:42:51","slug":"linux-dajian-wordpress","status":"publish","type":"post","link":"https:\/\/xianyijitan.top\/?p=118","title":{"rendered":"linux\u670d\u52a1\u5668\u642d\u5efawordpress"},"content":{"rendered":"<p><strong><em>\u4f7f\u7528centos7\u4e3a\u4f8b\uff0c\u4e0d\u501f\u52a9\u7b2c\u4e09\u65b9\u6258\u7ba1\uff0c\u76f4\u63a5\u642d\u5efawordpress\uff0c\u6700\u597d\u4f7f\u7528\u521a\u521a\u88c5\u597d\u7684linux\u7cfb\u7edf<\/em><\/strong><\/p>\n<p><strong>\u7b2c\u4e00\u6b65\uff1a\u66f4\u65b0\u7cfb\u7edf<\/strong><\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u66f4\u65b0\u7cfb\u7edf\u5c06\u83b7\u53d6\u6700\u65b0\u7684\u5168\u5c40\u548c\u5b89\u5168\u8865\u4e01\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo yum update<\/code><\/pre>\n<p><strong>\u7b2c\u4e8c\u6b65\uff1a\u5b89\u88c5Apache Web\u670d\u52a1\u5668\uff1a<\/strong><\/p>\n<p>\u200b   \u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo yum install httpd<\/code><\/pre>\n<p>\u200b   \u542f\u52a8Apache\u5e76\u8bbe\u7f6e\u4e3a\u5f00\u673a\u81ea\u52a8\u542f\u52a8\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo systemctl start httpd\nsudo systemctl enable httpd<\/code><\/pre>\n<p><strong>\u7b2c\u4e09\u6b65\uff1a\u5b89\u88c5MySQL\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a<\/strong><\/p>\n<p>\u200b   \u5b89\u88c5MySQL\u670d\u52a1\u5668\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo yum install mariadb-server<\/code><\/pre>\n<p>\u200b   \u542f\u52a8MySQL\u5e76\u8bbe\u7f6e\u4e3a\u5f00\u673a\u81ea\u542f\u52a8\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo systemctl start mariadb\nsudo systemctl enable mariadb<\/code><\/pre>\n<p>\u200b   \u8fd0\u884cMySQL\u5b89\u5168\u8bbe\u7f6e\u811a\u672c\u4ee5\u8bbe\u7f6eroot\u5bc6\u7801\u548c\u5176\u4ed6\u5b89\u5168\u9009\u9879:<\/p>\n<pre><code class=\"language-shell\">sudo mysql_secure_installation<\/code><\/pre>\n<p><strong>\u7b2c\u56db\u6b65\uff1a\u5b89\u88c5PHP7.2<\/strong><\/p>\n<p>\u200b   \u6dfb\u52a0\u5e76\u542f\u7528 Remi \u5b58\u50a8\u5e93\u4ee5\u5b89\u88c5 PHP 7.2\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo yum install epel-release\nsudo yum install https:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm\nsudo yum-config-manager --enable remi-php72<\/code><\/pre>\n<p>\u200b   \u5b89\u88c5PHP 7.2\u53ca\u6240\u9700\u7684\u6269\u5c55\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo yum install php php-cli php-fpm php-mysql php-json php-opcache php-gd php-mbstring php-curl php-xml php-pear php-bcmath<\/code><\/pre>\n<p>\u200b   \u914d\u7f6eApache\uff1a<\/p>\n<pre><code class=\"language-shell\">\/\/\u8fdb\u5165Apache\u7684\u914d\u7f6e\u6587\u4ef6\nvim \/etc\/httpd\/conf.d\/wordpress.conf\n\/\/\u52a0\u5165\u6216\u66f4\u6539\u4ee5\u4e0b\u4ee3\u7801\nLoadModule php7_module modules\/libphp7.so<\/code><\/pre>\n<p>\u200b   \u6d4b\u8bd5PHP\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\uff1a<\/p>\n<pre><code class=\"language-shell\">echo &quot;&lt;?phpphpinfo();?&gt;&quot; &gt; \/var\/www\/html\/info.php<\/code><\/pre>\n<p>\u200b   \u8981\u8bbf\u95eePHP\u4fe1\u606f\u9875\u9762\uff0c\u8bf7\u5728Web\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165\u4ee5\u4e0bURL\uff1a<\/p>\n<pre><code class=\"language-shell\">http:\/\/ip\u5730\u5740(\u6216\u57df\u540d)\/info.php<\/code><\/pre>\n<p>\u200b   \u60a8\u5c06\u770b\u5230PHP\u7248\u672c\u3001\u914d\u7f6e\u4fe1\u606f\u3001PHP\u6a21\u5757\u4ee5\u53caPHP\u8bbe\u7f6e\u3002\u5982\u679c\u60a8\u80fd\u770b\u5230\u5b83\uff0c\u5e76\u4e14\u6ca1\u6709\u51fa\u73b0\u9519\u8bef\uff0c\u5219\u8868\u660ePHP\u5df2\u7ecf\u6b63\u786e\u5730\u5b89\u88c5\u5e76\u6b63\u5728\u8fd0\u884c\u4e2d\u3002<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/xianyijitan.top\/wp-blog\/typora-user-images\/image-20230813220411867.png?w=960&#038;ssl=1\" alt=\"image-20230813220411867\" \/><\/p>\n<p><strong>\u7b2c\u4e94\u6b65\uff1a\u521b\u5efa\u6570\u636e\u5e93\uff1a<\/strong><\/p>\n<pre><code class=\"language-shell\">\/\/\u8fdb\u5165\u6570\u636e\u5e93\nmysql -uroot -p\n\u6570\u636e\u6570\u636e\u5e93\u5bc6\u7801\n\/\/\u67e5\u770b\u6709\u54ea\u4e9b\u6570\u636e\u5e93\nshow databases;\n\/\/\u4e3awordpress\u65b0\u5efa\u6570\u636e\u5e93\ncreate database wordpress<\/code><\/pre>\n<p><strong>\u7b2c\u516d\u6b65\uff1a\u4e0b\u8f7d\u5e76\u914d\u7f6ewordpress<\/strong><\/p>\n<p>\u200b   \u4e0b\u8f7d WordPress \u5e76\u89e3\u538b\u7f29\u5230 Apache \u7684\u7f51\u7ad9\u6839\u76ee\u5f55\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo yum install wget\nwget https:\/\/wordpress.org\/latest.tar.gz\ntar -zxvf latest.tar.gz -C \/var\/www\/html\/<\/code><\/pre>\n<p>\u200b   Apache\u6388\u4e88\u7528\u6237\u6743\u9650\uff1a<\/p>\n<pre><code class=\"language-shell\">sudo chown -R apache:apache \/var\/www\/html\/wordpress<\/code><\/pre>\n<p>\u200b   \u521b\u5efa<code>wp-config.php<\/code>\u914d\u7f6e\u6587\u4ef6\u5e76\u7f16\u8f91\u6570\u636e\u5e93\u4fe1\u606f\uff1a<\/p>\n<pre><code class=\"language-shell\">cd \/var\/www\/html\/wordpress\ncp wp-config-sample.php wp-config.php\nvim wp-config.php\n\/\/\u5728wp-config.php\u6587\u4ef6\u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u540d\u5b57\u3001\u7528\u6237\u3001\u5bc6\u7801\u7b49\u4fe1\u606f<\/code><\/pre>\n<p><strong>\u7b2c\u4e03\u6b65\uff1a\u914d\u7f6e\u865a\u62df\u4e3b\u673a\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<p>\u200b   \u5982\u679c\u60a8\u5e0c\u671b\u4e3a WordPress \u8bbe\u7f6e\u5355\u72ec\u7684\u865a\u62df\u4e3b\u673a\uff0c\u8bf7\u7f16\u8f91 Apache \u914d\u7f6e\u6587\u4ef6\u4ee5\u6dfb\u52a0\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u3002\u5c06\u4ee5\u4e0b\u5185\u5bb9\u6dfb\u52a0\u5230\u6587\u4ef6\u4e2d<\/p>\n<pre><code class=\"language-shell\">\/\/\u8fdb\u5165Apache\u7684\u914d\u7f6e\u6587\u4ef6\nvim \/etc\/httpd\/conf.d\/wordpress.conf\n\/\/\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a\n&lt;VirtualHost *:80&gt;\n    ServerName your-domain.com\n    DocumentRoot \/var\/www\/html\/wordpress\n    &lt;Directory \/var\/www\/html\/wordpress&gt;\n        AllowOverride All\n        Require all granted\n    &lt;\/Directory&gt;\n&lt;\/VirtualHost&gt;\n\/\/\u66ff\u6362your-domain.com\u4e3a\u60a8\u7684\u57df\u540d\uff0c\u5e76\u786e\u4fdd\u8def\u5f84\u548c\u6743\u9650\u8bbe\u7f6e\u6b63\u786e\u3002\n\u91cd\u542fApache\u5373\u53ef\u914d\u7f6e\u751f\u6548\uff1a\nsudo systemctl restart httpd<\/code><\/pre>\n<p><strong>\u7b2c\u516b\u6b65\uff1a\u8bbf\u95eeWordPress\u5b89\u88c5\u754c\u9762<\/strong><\/p>\n<p>\u200b   \u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\u60a8\u7684\u57df\u540d\uff0c\u7136\u540e\u6309\u7167 WordPress \u5b89\u88c5\u7684\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/xianyijitan.top\/wp-blog\/typora-user-images\/image-20230813220942247.png?w=960&#038;ssl=1\" alt=\"image-20230813220942247\" \/><\/p>\n<p>\u200b   \u5728\u6570\u636e\u5e93\u8fde\u63a5\u90e8\u5206\uff0c\u63d0\u4f9b\u4e4b\u524d\u521b\u5efa\u7684\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\u663e\u793a\u5982\u4e0b\u754c\u9762\u3002<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/xianyijitan.top\/wp-blog\/typora-user-images\/image-20230813221022200.png?w=960&#038;ssl=1\" alt=\"image-20230813221022200\" \/><\/p>\n<p><strong>\u7b2c\u4e5d\u6b65\uff1a\u5b8c\u6210Wordpress\u5b89\u88c5\uff0c\u5e76\u8fdb\u884c\u4f18\u5316\u548c\u5b89\u5168\u8bbe\u7f6e<\/strong><\/p>\n<p>\u200b   \u8fdb\u5165\u5b89\u88c5\u63d2\u4ef6\u754c\u9762\uff1a<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/xianyijitan.top\/wp-blog\/typora-user-images\/image-20230813221411886.png?w=960&#038;ssl=1\" alt=\"image-20230813221411886\" \/><\/p>\n<p>\u200b   \u5b89\u88c5\u5b89\u5168\u63d2\u4ef6\u4ee5\u4fdd\u62a4 WordPress\uff0c\u5982 Wordfence \u6216 Sucuri Security\u3002<\/p>\n<p>\u200b   \u914d\u7f6e\u5907\u4efd\u89e3\u51b3\u65b9\u6848\uff0c\u4ee5\u786e\u4fdd\u60a8\u7684\u6570\u636e\u5f97\u5230\u53ca\u65f6\u5907\u4efd\u3002<\/p>\n<p>\u200b   \u5b89\u88c5\u7f13\u5b58\u63d2\u4ef6\uff0c\u4f8b\u5982 W3 Total Cache \u6216 WP Super Cache\uff0c\u4ee5\u63d0\u9ad8\u7f51\u7ad9\u6027\u80fd\u3002<\/p>\n<p><strong><em>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9aa4\u540e\uff0c\u60a8\u5e94\u8be5\u5df2\u7ecf\u6210\u529f\u90e8\u7f72\u4e86\u57fa\u4e8eCentOS 7\u7684WordPress\u7f51\u7ad9\uff0c\u6839\u636e\u60a8\u7684\u9700\u6c42\uff0c\u60a8\u8fd8\u53ef\u4ee5\u8fdb\u4e00\u6b65\u8fdb\u884c\u5b9a\u5236\u548c\u4f18\u5316\u3002<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528centos7\u4e3a\u4f8b\uff0c\u4e0d\u501f\u52a9\u7b2c\u4e09\u65b9\u6258\u7ba1\uff0c\u76f4\u63a5\u642d\u5efawordpress\uff0c\u6700\u597d\u4f7f\u7528\u521a\u521a\u88c5\u597d\u7684linux\u7cfb\u7edf \u7b2c\u4e00\u6b65\uff1a\u66f4\u65b0\u7cfb\u7edf \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u66f4\u65b0\u7cfb\u7edf\u5c06\u83b7\u53d6\u6700\u65b0\u7684\u5168\u5c40\u548c\u5b89\u5168\u8865\u4e01\uff1a sudo yum update \u7b2c\u4e8c\u6b65\uff1a\u5b89\u88c5Apache Web\u670d\u52a1\u5668\uff1a \u200b \u4ee3\u7801\u5982\u4e0b\uff1a sudo yum install httpd \u200b \u542f\u52a8Apache\u5e76\u8bbe\u7f6e\u4e3a\u5f00\u673a\u81ea\u52a8\u542f\u52a8\uff1a sudo systemctl start httpd sudo systemctl enable httpd \u7b2c\u4e09\u6b65\uff1a\u5b89\u88c5MySQL\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a \u200b \u5b89\u88c5MySQL\u670d\u52a1\u5668\uff1a sudo yum install mariadb-server \u200b \u542f\u52a8MySQL\u5e76\u8bbe\u7f6e\u4e3a\u5f00\u673a\u81ea\u542f\u52a8\uff1a sudo systemctl start mariadb sudo systemctl enable mariadb \u200b \u8fd0\u884cMySQL\u5b89\u5168\u8bbe\u7f6e\u811a\u672c\u4ee5\u8bbe\u7f6eroot\u5bc6\u7801\u548c\u5176\u4ed6\u5b89\u5168\u9009\u9879: sudo mysql_secure_installation \u7b2c\u56db\u6b65\uff1a\u5b89\u88c5PHP7.2 \u200b \u6dfb\u52a0\u5e76\u542f\u7528 Remi \u5b58\u50a8\u5e93\u4ee5\u5b89\u88c5 PHP 7.2\uff1a sudo yum install epel-release sudo yum install https:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm sudo yum-config-manager &#8211;enable remi-php72 \u200b \u5b89\u88c5PHP 7.2\u53ca\u6240\u9700\u7684\u6269\u5c55\uff1a sudo yum install php php-cli php-fpm php-mysql php-json php-opcache php-gd php-mbstring php-curl php-xml php-pear php-bcmath \u200b \u914d\u7f6eApache\uff1a \/\/\u8fdb\u5165Apache\u7684\u914d\u7f6e\u6587\u4ef6 vim \/etc\/httpd\/conf.d\/wordpress.conf \/\/\u52a0\u5165\u6216\u66f4\u6539\u4ee5\u4e0b\u4ee3\u7801 LoadModule php7_module modules\/libphp7.so \u200b \u6d4b\u8bd5PHP\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\uff1a echo &quot;&lt;?phpphpinfo();?&gt;&quot; &gt; \/var\/www\/html\/info.php \u200b \u8981\u8bbf\u95eePHP\u4fe1\u606f\u9875\u9762\uff0c\u8bf7\u5728Web\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165\u4ee5\u4e0bURL\uff1a http:\/\/ip\u5730\u5740(\u6216\u57df\u540d)\/info.php \u200b \u60a8\u5c06\u770b\u5230PHP\u7248\u672c\u3001\u914d\u7f6e\u4fe1\u606f\u3001PHP\u6a21\u5757\u4ee5\u53caPHP\u8bbe\u7f6e\u3002\u5982\u679c\u60a8\u80fd\u770b\u5230\u5b83\uff0c\u5e76\u4e14\u6ca1\u6709\u51fa\u73b0\u9519\u8bef\uff0c\u5219\u8868\u660ePHP\u5df2\u7ecf\u6b63\u786e\u5730\u5b89\u88c5\u5e76\u6b63\u5728\u8fd0\u884c\u4e2d\u3002 \u7b2c\u4e94\u6b65\uff1a\u521b\u5efa\u6570\u636e\u5e93\uff1a \/\/\u8fdb\u5165\u6570\u636e\u5e93 mysql -uroot -p \u6570\u636e\u6570\u636e\u5e93\u5bc6\u7801 \/\/\u67e5\u770b\u6709\u54ea\u4e9b\u6570\u636e\u5e93 show databases; \/\/\u4e3awordpress\u65b0\u5efa\u6570\u636e\u5e93 create database wordpress \u7b2c\u516d\u6b65\uff1a\u4e0b\u8f7d\u5e76\u914d\u7f6ewordpress \u200b \u4e0b\u8f7d WordPress \u5e76\u89e3\u538b\u7f29\u5230 Apache \u7684\u7f51\u7ad9\u6839\u76ee\u5f55\uff1a sudo yum install wget wget https:\/\/wordpress.org\/latest.tar.gz tar -zxvf latest.tar.gz -C \/var\/www\/html\/ \u200b Apache\u6388\u4e88\u7528\u6237\u6743\u9650\uff1a sudo chown -R apache:apache \/var\/www\/html\/wordpress \u200b \u521b\u5efawp-config.php\u914d\u7f6e\u6587\u4ef6\u5e76\u7f16\u8f91\u6570\u636e\u5e93\u4fe1\u606f\uff1a cd \/var\/www\/html\/wordpress cp wp-config-sample.php wp-config.php vim wp-config.php \/\/\u5728wp-config.php\u6587\u4ef6\u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u540d\u5b57\u3001\u7528\u6237\u3001\u5bc6\u7801\u7b49\u4fe1\u606f \u7b2c\u4e03\u6b65\uff1a\u914d\u7f6e\u865a\u62df\u4e3b\u673a\uff08\u53ef\u9009\uff09 \u200b \u5982\u679c\u60a8\u5e0c\u671b\u4e3a WordPress \u8bbe\u7f6e\u5355\u72ec\u7684\u865a\u62df\u4e3b\u673a\uff0c\u8bf7\u7f16\u8f91 Apache \u914d\u7f6e\u6587\u4ef6\u4ee5\u6dfb\u52a0\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u3002\u5c06\u4ee5\u4e0b\u5185\u5bb9\u6dfb\u52a0\u5230\u6587\u4ef6\u4e2d \/\/\u8fdb\u5165Apache\u7684\u914d\u7f6e\u6587\u4ef6 vim \/etc\/httpd\/conf.d\/wordpress.conf \/\/\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a &lt;VirtualHost *:80&gt; ServerName your-domain.com DocumentRoot \/var\/www\/html\/wordpress &lt;Directory \/var\/www\/html\/wordpress&gt; AllowOverride All Require all granted &lt;\/Directory&gt; &lt;\/VirtualHost&gt; \/\/\u66ff\u6362your-domain.com\u4e3a\u60a8\u7684\u57df\u540d\uff0c\u5e76\u786e\u4fdd\u8def\u5f84\u548c\u6743\u9650\u8bbe\u7f6e\u6b63\u786e\u3002 \u91cd\u542fApache\u5373\u53ef\u914d\u7f6e\u751f\u6548\uff1a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-lixx"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/xianyijitan.top\/index.php?rest_route=\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xianyijitan.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xianyijitan.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xianyijitan.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xianyijitan.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=118"}],"version-history":[{"count":5,"href":"https:\/\/xianyijitan.top\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":250,"href":"https:\/\/xianyijitan.top\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions\/250"}],"wp:attachment":[{"href":"https:\/\/xianyijitan.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xianyijitan.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xianyijitan.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}