{"id":464,"date":"2024-04-11T16:03:32","date_gmt":"2024-04-11T08:03:32","guid":{"rendered":"http:\/\/8.141.4.74\/?p=464"},"modified":"2024-04-11T16:03:32","modified_gmt":"2024-04-11T08:03:32","slug":"lamp%e6%9e%b6%e6%9e%84%e5%ae%9e%e7%8e%b0%e7%bd%91%e7%bb%9c%e5%85%b1%e4%ba%ab%e5%ad%98%e5%82%a8","status":"publish","type":"post","link":"http:\/\/8.141.4.74\/?p=464","title":{"rendered":"LAMP\u67b6\u6784\u5b9e\u73b0\u7f51\u7edc\u5171\u4eab\u5b58\u50a8"},"content":{"rendered":"<h2>\u67b6\u6784\u8bbe\u8ba1<\/h2>\n<p>\u67b6\u6784\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/typora-images-1307361841.cos.ap-beijing.myqcloud.com\/img\/image-20240411113351174.png\" alt=\"image-20240411113351174\" \/> <\/p>\n<p>\u5b9e\u73b0\u903b\u8f91\uff1a<\/p>\n<blockquote>\n<p>\u8be5\u67b6\u6784\u662f\u4e00\u4e2a\u57fa\u4e8eLinux\u7684\u5206\u5e03\u5f0fWordPress\u7f51\u7ad9\u90e8\u7f72\uff0c\u7ed3\u5408\u4e86NFS\u548cMySQL\u6570\u636e\u5e93\uff0c\u652f\u6301\u8d1f\u8f7d\u5747\u8861\u548c\u5185\u5bb9\u5171\u4eab\u3002<\/p>\n<p>\u8be5\u5206\u5e03\u5f0f\u7f51\u7edc\u5e94\u7528\u67b6\u6784\uff0c\u5176\u4e2d\u5305\u542b\u56db\u53f0\u670d\u52a1\u5668\uff0c\u5206\u522b\u627f\u62c5\u4e0d\u540c\u7684\u89d2\u8272\u4ee5\u652f\u6301WordPress\u7f51\u7ad9\u7684\u8fd0\u884c\u548c\u7ba1\u7406\u3002\u8be5\u67b6\u6784\u652f\u6301\u5197\u4f59\u548c\u8d44\u6e90\u5171\u4eab\uff0c\u4f18\u5316\u4e86\u8d44\u6e90\u5229\u7528\u7387\u548c\u53ef\u7528\u6027\u3002<\/p>\n<ol>\n<li><strong>\u6570\u636e\u5e93\u670d\u52a1\u5668<\/strong>\uff08IP\u5730\u5740\uff1a10.0.0.131\uff09:\n<ul>\n<li>\u4e00\u53f0\u670d\u52a1\u5668\u4e13\u95e8\u914d\u7f6e\u4e3aMySQL\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u5b58\u50a8WordPress\u7f51\u7ad9\u7684\u6240\u6709\u6570\u636e\uff0c\u5305\u62ec\u6587\u7ae0\u5185\u5bb9\u3001\u7528\u6237\u4fe1\u606f\u548c\u7f51\u7ad9\u8bbe\u7f6e\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u7f51\u7edc\u6587\u4ef6\u7cfb\u7edf\uff08NFS\uff09\u670d\u52a1\u5668<\/strong>\uff08IP\u5730\u5740\uff1a10.0.0.137\uff09:\n<ul>\n<li>NFS\u670d\u52a1\u5668\u914d\u7f6e\u4e86\u5171\u4eab\u76ee\u5f55<code>\/data\/wordpress\/wp-content\/uploads<\/code>\uff0c\u8be5\u76ee\u5f55\u5b58\u50a8WordPress\u7f51\u7ad9\u7684\u4e0a\u4f20\u5185\u5bb9\uff0c\u5982\u5a92\u4f53\u6587\u4ef6\u548c\u7528\u6237\u4e0a\u4f20\u7684\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u4e24\u53f0Web\u670d\u52a1\u5668<\/strong>\uff08IP\u5730\u5740\uff1a10.0.0.107\u548c10.0.0.134\uff09:\n<ul>\n<li>\u6bcf\u53f0\u670d\u52a1\u5668\u90fd\u8fd0\u884c\u7740Linux, Apache\uff08HTTPD\uff09\u548cPHP-FPM\uff0c\u4ee5\u63d0\u4f9b\u7f51\u9875\u5185\u5bb9\u548c\u6267\u884cWordPress PHP\u811a\u672c\u3002<\/li>\n<li>\u8fd9\u4e24\u53f0Web\u670d\u52a1\u5668\u914d\u7f6e\u4e3a\u901a\u8fc7NFS\u6302\u8f7d\u5171\u4eab\u7684<code>wp-content\/uploads<\/code>\u76ee\u5f55\u5230\u672c\u5730\u8def\u5f84<code>\/var\/www\/html\/wp-content\/uploads<\/code>\u3002\u8fd9\u6837\uff0c\u65e0\u8bba\u54ea\u53f0\u670d\u52a1\u5668\u5904\u7406\u7528\u6237\u8bf7\u6c42\uff0c\u90fd\u80fd\u4fdd\u8bc1\u7528\u6237\u8bbf\u95ee\u5230\u76f8\u540c\u7684\u4e0a\u4f20\u5185\u5bb9\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u5ba2\u6237\u7aef\u8bbf\u95ee\u548c\u57df\u540d\u89e3\u6790<\/strong>:\n<ul>\n<li>\u5ba2\u6237\u7aef\u8ba1\u7b97\u673a\uff08\u5982\u4ee3\u8868\u7528\u6237\u8bbf\u95ee\u7f51\u7ad9\u7684\u4e2a\u4eba\u7535\u8111\uff09\u901a\u8fc7\u8bbe\u7f6ehosts\u6587\u4ef6\uff0c\u5c06\u57df\u540d\uff08\u4f8b\u5982<code>blog.yuyu.org<\/code>\uff09\u89e3\u6790\u5230\u4e24\u53f0Web\u670d\u52a1\u5668\u7684IP\u5730\u5740\u3002\u8fd9\u5141\u8bb8\u60a8\u6d4b\u8bd5\u8d1f\u8f7d\u5747\u8861\u548c\u5197\u4f59\u7b56\u7565\uff0c\u786e\u4fdd\u4e24\u53f0Web\u670d\u52a1\u5668\u90fd\u80fd\u72ec\u7acb\u54cd\u5e94\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/blockquote>\n<h2>\u5b89\u88c5NFS<\/h2>\n<pre><code class=\"language-bash\">[root@nfs ~]# yum install nfs-utils\nLast metadata expiration check: 3:11:19 ago on Thu 11 Apr 2024 09:54:09 AM CST.\nPackage nfs-utils-1:2.5.4-20.el9.x86_64 is already installed.\nDependencies resolved.\nNothing to do.\nComplete!\n[root@nfs ~]# systemctl enable --now nfs-server\n[root@nfs ~]# mkdir -pv \/data\/wordpress\/wp-content\/uploads\n[root@nfs ~]# cat \/etc\/exports\n\/data\/wordpress\/wp-content\/uploads\/     10.0.0.0\/24(rw)\n[root@nfs ~]# exportfs -r\n[root@nfs ~]# exportfs -v\n\/data\/wordpress\/wp-content\/uploads\n                10.0.0.0\/24(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)\n\n# \u56e0\u4e3alap\u673a\u5668\u4e0a\u7684apache\u7528\u6237\u7684id\u5c31\u662f48\uff0c\u5982\u679c\u8fd9\u91cc\u4e0d\u8bbe\u7f6e\u621048\u7684\u8bdd\uff0c\u5ba2\u6237\u7aef\u6302\u8f7d\u4ee5\u540e\u662f\u5199\u4e0d\u8fdb\u53bb\u7684                \n[root@nfs ~]# chown -R 48:48 \/data\/wordpress\/wp-content\/<\/code><\/pre>\n<h2>\u5b89\u88c5MySQL 8.0<\/h2>\n<pre><code class=\"language-bash\">[root@mysql ~]# yum install mysql-server\nLast metadata expiration check: 4:02:41 ago on Thu 11 Apr 2024 09:53:25 AM CST.\nPackage mysql-server-8.0.36-1.el9_3.x86_64 is already installed.\nDependencies resolved.\nNothing to do.\nComplete!\n[root@mysql ~]# systemctl enable --now mysqld\n[root@mysql ~]# mysql\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 335\nServer version: 8.0.36 Source distribution\n\nCopyright (c) 2000, 2024, Oracle and\/or its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType &#039;help;&#039; or &#039;\\h&#039; for help. Type &#039;\\c&#039; to clear the current input statement.\n\nmysql&gt; create database wordpress;\nmysql&gt; create user wordpress@&#039;10.0.0.%&#039; identified by &#039;123456&#039;;\nmysql&gt; grant all on wordpress.* to wordpress@&#039;10.0.0.%&#039;;\n<\/code><\/pre>\n<h2>\u5b89\u88c5LAP<\/h2>\n<pre><code class=\"language-bash\"># \u672c\u6b21\u4e24\u53f0\u670d\u52a1\u5668\u4f7f\u7528\u7684Rocky Linux 9.0\u548cRocky Linux 9.2\n# \u5b89\u88c5httpd\u3001php-fpm\u3001php-mysqlnd\u3001nfs-utils\n[root@Rocky9 themes]#dnf -y install httpd php-fpm php-mysqlnd nfs-utils\nLast metadata expiration check: 3:37:21 ago on Thu 11 Apr 2024 09:24:45 AM CST.\nPackage httpd-2.4.57-5.el9.x86_64 is already installed.\nPackage php-fpm-8.0.30-1.el9_2.x86_64 is already installed.\nPackage php-mysqlnd-8.0.30-1.el9_2.x86_64 is already installed.\nPackage nfs-utils-1:2.5.4-20.el9.x86_64 is already installed.\nDependencies resolved.\nNothing to do.\nComplete!\n[root@Rocky9 themes]#\n#\u5f00\u673a\u81ea\u542f\u52a8\u5e76\u542f\u52a8\n[root@Rocky9 ~]# systemctl enable --now httpd php-fpm\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/httpd.service \u2192 \/usr\/lib\/systemd\/system\/httpd.service.\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/php-fpm.service \u2192 \/usr\/lib\/systemd\/system\/php-fpm.service.\n[root@Rocky9 ~]# showmount -e 10.0.0.137\nExport list for 10.0.0.137:\n\/data\/wordpress\/wp-content\/uploads 10.0.0.0\/24\n[root@Rocky9 ~]# vi \/etc\/fstab\n10.0.0.137:\/data\/wordpress\/wp-content\/uploads\/  \/var\/www\/html\/wp-content\/uploads\/               nfs     _netdev         0 0\n[root@Rocky9 ~]# mkdir -pv \/var\/www\/html\/wp-content\/uploads\/\n# \u4e0a\u4f20wordpress\u538b\u7f29\u5305latest-zh_CN.zip\n[root@Rocky9 ~]# unzip latest-zh_CN.zip\n[root@Rocky9 ~]# ls\n[root@Rocky9 ~]#ls\nanaconda-ks.cfg  latest-zh_CN.zip  original-ks.cfg  wordpress\n[root@Rocky9 ~]# cp -ar wordpress\/* \/var\/www\/html\n#\u4fee\u6539\u6240\u5c5e\u4e3b\u548c\u7ec4\n[root@Rocky9 ~]# chown -R apache.apache \/var\/www\/html\n[root@Rocky9 ~]# mount -a\n[root@Rocky9 themes]#df\nFilesystem                                    1K-blocks    Used Available Use% Mounted on\ndevtmpfs                                           4096       0      4096   0% \/dev\ntmpfs                                            479376       0    479376   0% \/dev\/shm\ntmpfs                                            191752    7120    184632   4% \/run\n\/dev\/sda2                                     104806400 1987436 102818964   2% \/\n\/dev\/sda3                                      52403200  398400  52004800   1% \/data\n\/dev\/sda1                                       9976648  146248   9302016   2% \/boot\n10.0.0.137:\/data\/wordpress\/wp-content\/uploads  52363264  480000  51883264   1% \/var\/www\/html\/wp-content\/uploads\ntmpfs                                             95872       0     95872   0% \/run\/user\/0\n[root@Rocky9 themes]<\/code><\/pre>\n<h2>\u5ba2\u6237\u7aef\u8bbf\u95ee<\/h2>\n<pre><code class=\"language-bash\"># \u5728windows\/system32\/drivers\/etc\/hosts\u914d\u7f6e\u6620\u5c04\u5173\u7cfb\n10.0.0.107 blog.yuyu.org\nhttp:\/\/blog.yuyu.org<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/typora-images-1307361841.cos.ap-beijing.myqcloud.com\/img\/image-20240411141723430.png\" alt=\"image-20240411141723430\" style=\"zoom: 50%;\" \/> <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/typora-images-1307361841.cos.ap-beijing.myqcloud.com\/img\/image-20240411141821363.png\" alt=\"image-20240411141821363\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67b6\u6784\u8bbe\u8ba1 \u67b6\u6784\u56fe\uff1a \u5b9e\u73b0\u903b\u8f91\uff1a \u8be5\u67b6\u6784\u662f\u4e00\u4e2a\u57fa\u4e8eLinux\u7684\u5206\u5e03\u5f0fWordPress\u7f51\u7ad9\u90e8\u7f72\uff0c\u7ed3\u5408\u4e86 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[],"views":210,"_links":{"self":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/464"}],"collection":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=464"}],"version-history":[{"count":1,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/464\/revisions"}],"predecessor-version":[{"id":465,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/464\/revisions\/465"}],"wp:attachment":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=464"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}