{"id":2968,"date":"2017-12-19T11:03:28","date_gmt":"2017-12-19T03:03:28","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=2968"},"modified":"2025-02-08T11:06:13","modified_gmt":"2025-02-08T03:06:13","slug":"centos%e4%b8%8b%e5%88%a9%e7%94%a8lamp%e6%90%ad%e5%bb%bawordpress%e5%8d%9a%e5%ae%a2","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/hemanual\/centos%e4%b8%8b%e5%88%a9%e7%94%a8lamp%e6%90%ad%e5%bb%bawordpress%e5%8d%9a%e5%ae%a2\/","title":{"rendered":"CentOS\u4e0b\u5229\u7528LAMP\u642d\u5efaWordPress\u535a\u5ba2"},"content":{"rendered":"\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>WordPress\u662f\u4f7f\u7528PHP\u8bed\u8a00\u5f00\u53d1\u7684\u535a\u5ba2\u5e73\u53f0\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u652f\u6301PHP\u548cMySQL\u6570\u636e\u5e93\u7684\u670d\u52a1\u5668\u4e0a\u67b6\u8bbe\u5c5e\u4e8e\u81ea\u5df1\u7684\u7f51\u7ad9\u3002\u4e5f\u53ef\u4ee5\u628a WordPress\u5f53\u4f5c\u4e00\u4e2a\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf\uff08CMS\uff09\u6765\u4f7f\u7528\u3002 WordPress\u662f\u4e00\u6b3e\u4e2a\u4eba\u535a\u5ba2\u7cfb\u7edf\uff0c\u5e76\u9010\u6b65\u6f14\u5316\u6210\u4e00\u6b3e\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf\u8f6f\u4ef6\uff0c\u5b83\u662f\u4f7f\u7528PHP\u8bed\u8a00\u548cMySQL\u6570\u636e\u5e93\u5f00\u53d1\u7684\u3002\u7528\u6237\u53ef\u4ee5\u5728\u652f\u6301 PHP \u548c MySQL\u6570\u636e\u5e93\u7684\u670d\u52a1\u5668\u4e0a\u4f7f\u7528\u81ea\u5df1\u7684\u535a\u5ba2\u3002<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>&nbsp;<\/p>\n\n\n\n<p>\u73af\u5883\u8bf4\u660e\uff1a<\/p>\n\n\n\n<p>\u5728\u540c\u4e00\u53f0\u4e3b\u673a\u4e0a\u5b9e\u73b0LAMP\uff08Linux + Apache + MariaDB + PHP\uff09<br>CentOS 7.3\u3001Apache 2.4.6\u3001MariaDB 5.5.52\u3001PHP 5.4.16<\/p>\n\n\n\n<div><strong>1 \u5b89\u88c5LAMP<\/strong><\/div>\n\n\n\n<p>\u91c7\u7528yum\u65b9\u5f0f\u8fdb\u884c\u5b89\u88c5httpd\u3001MariaDB\u3001php\u3001php-mysql\uff0cphp-mysql\u7528\u6765\u8fdb\u884cphp\u548cMariaDB\u6570\u636e\u5e93\u7684\u8fde\u63a5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# yum install httpd mariadb-server php php-mysql -y\n<\/pre>\n\n\n\n<div><strong>2 \u521b\u5efa\u65b0\u7684\u865a\u62df\u4e3b\u673a<\/strong><\/div>\n\n\n\n<div><strong>\uff081\uff09\u65b0\u589e\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u6587\u4ef6<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# vim \/etc\/httpd\/conf.d\/vhost.conf\n\nDocumentRoot \"\/var\/www\/wordpress\"\nServerName www.mywordpress.com\n&lt;Directory \"\/var\/www\/wordpress\"&gt;\nAllowOverride None\nRequire all granted\n<\/pre>\n\n\n\n<div><strong>\uff082\uff09\u521b\u5efa\u6240\u9700\u76ee\u5f55<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# mkdir \/var\/www\/wordpress\n<\/pre>\n\n\n\n<div><strong>3 \u5728\u865a\u62df\u4e3b\u673a\u4e3b\u76ee\u5f55\/var\/www\/wordpress\u4e0b\u65b0\u5efaindex.php\u6587\u4ef6<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# vim \/var\/www\/wordpress\/index.php\n&lt;!--?php phpinfo(); ?--&gt;\n\n<\/pre>\n\n\n\n<div><strong>4 \u68c0\u67e5\u8bed\u6cd5\u5e76\u542f\u52a8httpd\u670d\u52a1<\/strong><\/div>\n\n\n\n<div><strong>\uff081\uff09\u68c0\u67e5\u8bed\u6cd5<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# httpd -t\nSyntax OK\n<\/pre>\n\n\n\n<div><strong>\uff082\uff09\u542f\u52a8httpd\u670d\u52a1<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# systemctl start httpd.service\n<\/pre>\n\n\n\n<div><strong>5 \u6d4b\u8bd5<\/strong><\/div>\n\n\n\n<p>\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165www.mywordpress.com<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/cn.hostease.com\/xueyuan\/wp-content\/uploads\/2017\/12\/apache.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"475\" src=\"https:\/\/cn.hostease.com\/xueyuan\/wp-content\/uploads\/2017\/12\/apache-1024x475.png\" alt=\"\" class=\"wp-image-9943\" srcset=\"https:\/\/cn.hostease.com\/xueyuan\/wp-content\/uploads\/2017\/12\/apache-1024x475.png 1024w, https:\/\/cn.hostease.com\/xueyuan\/wp-content\/uploads\/2017\/12\/apache-300x139.png 300w, https:\/\/cn.hostease.com\/xueyuan\/wp-content\/uploads\/2017\/12\/apache-768x356.png 768w, https:\/\/cn.hostease.com\/xueyuan\/wp-content\/uploads\/2017\/12\/apache-1536x712.png 1536w, https:\/\/cn.hostease.com\/xueyuan\/wp-content\/uploads\/2017\/12\/apache.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div>\n\n\n<p><\/p>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230PHP\u9ed8\u8ba4\u9875\u9762\u5df2\u7ecf\u6210\u529f\u663e\u793a\uff0c\u8bf4\u660e\u6d4b\u8bd5\u6210\u529f<\/p>\n\n\n\n<div><strong>6 \u4e0b\u8f7dwordpress\u538b\u7f29\u5305\uff0cwordpress-4.7.4-zh_CN.tar.gz<\/strong><\/div>\n\n\n\n<div><strong>\uff081\uff09\u89e3\u538b\u7f29<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# tar -xf wordpress-4.7.4-zh_CN.tar.gz\n<\/pre>\n\n\n\n<div><strong>\uff082\uff09\u628a\u89e3\u538b\u7f29\u540e\u5f97\u5230\u7684\u6587\u4ef6\uff08wordpress\uff09\u590d\u5236\u5230DocumentRoot\uff08\/var\/www\/wordpress\/\uff09\u4e0b<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# cp -a wordpress \/var\/www\/wordpress\/\n<\/pre>\n\n\n\n<div><strong>7 \u542f\u52a8MariaDB\u670d\u52a1<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# systemctl start mariadb\n<\/pre>\n\n\n\n<div><strong>8 \u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95eewordpress<\/strong><\/div>\n\n\n\n<p>\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165https:\/\/www.mywordpress.com\/wordpress<\/p>\n\n\n\n<p>\u6ce8\u610f\uff1a\u914d\u7f6eDNS\u670d\u52a1\u5668\u89e3\u6790www.test.com \u4e3a192.168.29.100<br>\u6216\u8005 \u4fee\u6539windows \u4e0b\u7684C:\\Windows\\Systeme32\\drivers\\etc\\hosts\u6587\u4ef6<br>192.168.29.100 www.test.com<\/p>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u5df2\u7ecf\u51fa\u4e86wordpress \u9875\u9762\uff0c\u53ef\u4ee5\u70b9\u51fb\u201c\u73b0\u5728\u5c31\u5f00\u59cb\u201d\u5c31\u884c\u914d\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u624b\u52a8\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<div><strong>9 \u4fee\u6539wordpress\u914d\u7f6e\u6587\u4ef6<\/strong><\/div>\n\n\n\n<div><strong>\uff081\uff09\u8fdb\u5165WordPress\u76ee\u5f55\uff08\/var\/www\/wordpress\/wordpress\/\uff09<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# cd \/var\/www\/wordpress\/wordpress\/\n<\/pre>\n\n\n\n<div><strong>\uff082\uff09\u590d\u5236cp wp-config-sample.php\u6a21\u677f\u6587\u4ef6\u4e3a wp-config.php\uff0c\u7136\u540e\u7f16\u8f91<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@CentOS7 ~]# vim \/var\/www\/wordpress\/wordpress\/wp-config.php\n\/\/ ** MySQL \u8bbe\u7f6e - \u5177\u4f53\u4fe1\u606f\u6765\u81ea\u60a8\u6b63\u5728\u4f7f\u7528\u7684\u4e3b\u673a ** \/\/\n\/** WordPress\u6570\u636e\u5e93\u7684\u540d\u79f0 *\/\ndefine('DB_NAME', 'wordpress');\n\/** MySQL\u6570\u636e\u5e93\u7528\u6237\u540d *\/\ndefine('DB_USER', 'test1');\n\/** MySQL\u6570\u636e\u5e93\u5bc6\u7801 *\/\ndefine('DB_PASSWORD', '123456');\n\/** MySQL\u4e3b\u673a *\/\ndefine('DB_HOST', 'localhost');\n<\/pre>\n\n\n\n<div><strong>10 \u5728\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u6570\u636e\u5e93\u548c\u7528\u6237<\/strong><\/div>\n\n\n\n<div><strong>\uff081\uff09\u521b\u5efa\u6570\u636e\u5e93<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">MariaDB [(none)]&gt; create database wordpress;\nQuery OK, 1 row affected (0.00 sec)\n<\/pre>\n\n\n\n<div><strong>\uff082\uff09\u521b\u5efa\u7528\u6237<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">MariaDB [(none)]&gt; create user 'test1'@'localhost' identified by '123456';\nQuery OK, 0 rows affected (0.00 sec)\n<\/pre>\n\n\n\n<div><strong>\uff083\uff09\u7ed9\u7528\u6237\u6388\u6743<\/strong><\/div>\n\n\n\n<pre class=\"wp-block-preformatted\">MariaDB [(none)]&gt; grant all on wordpress.* to 'test1'@'localhost';\nQuery OK, 0 rows affected (0.01 sec)\n<\/pre>\n\n\n\n<div><strong>11 \u518d\u6b21\u8bbf\u95eeWordPress<\/strong><\/div>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/www.mywordpress.com\/wordpress\n<\/div><\/figure>\n\n\n\n<p><br>\u586b\u5165\u76f8\u5173\u4fe1\u606f\uff0c\u5c31\u53ef\u4ee5\u6b63\u5e38\u8bbf\u95ee\u535a\u5ba2\u4e86\u3002<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u662f\u4f7f\u7528PHP\u8bed\u8a00\u5f00\u53d1\u7684\u535a\u5ba2\u5e73\u53f0\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u652f\u6301PHP\u548cMySQL\u6570\u636e\u5e93\u7684\u670d\u52a1\u5668\u4e0a\u67b6\u8bbe\u5c5e\u4e8e\u81ea\u5df1 &#8230; <a title=\"CentOS\u4e0b\u5229\u7528LAMP\u642d\u5efaWordPress\u535a\u5ba2\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/hemanual\/centos%e4%b8%8b%e5%88%a9%e7%94%a8lamp%e6%90%ad%e5%bb%bawordpress%e5%8d%9a%e5%ae%a2\/\" aria-label=\"\u9605\u8bfb CentOS\u4e0b\u5229\u7528LAMP\u642d\u5efaWordPress\u535a\u5ba2\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,49,5],"tags":[495,106,23],"class_list":["post-2968","post","type-post","status-publish","format-standard","hentry","category-hemanual","category-linux","category-jishu","tag-centos7-x","tag-lamp","tag-wordpress"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=2968"}],"version-history":[{"count":3,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2968\/revisions"}],"predecessor-version":[{"id":9982,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2968\/revisions\/9982"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=2968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=2968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=2968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}