{"id":325,"date":"2021-07-28T14:42:14","date_gmt":"2021-07-28T06:42:14","guid":{"rendered":"http:\/\/egonlin.com\/?p=325"},"modified":"2024-03-21T15:54:01","modified_gmt":"2024-03-21T07:54:01","slug":"%e7%ac%ac%e4%ba%8c%e8%8a%82%ef%bc%9a%e6%9e%b6%e6%9e%84%e6%8b%86%e5%88%86","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=325","title":{"rendered":"\u7b2c\u4e8c\u8282\uff1a\u67b6\u6784\u62c6\u5206"},"content":{"rendered":"<h2>nfs\u4e00\u3001\u56de\u987e<\/h2>\n<h3>1.\u642d\u5efaLNMP\u73af\u5883<\/h3>\n<pre><code class=\"language-bash\">#\u642d\u5efanginx\n1.\u914d\u7f6eyum\u6e90\n2.\u5b89\u88c5nginx\n3.\u914d\u7f6enginx\n4.\u521b\u5efa\u7528\u6237\n5.\u542f\u52a8\u670d\u52a1\n\n#\u642d\u5efaphp\n1.\u4e0a\u4f20\u670d\u52a1\u5305\n2.\u89e3\u538b\u5305\n3.\u5b89\u88c5\u672c\u5730rpm\u5305\n4.\u914d\u7f6ephp\n5.\u542f\u52a8\n\n#\u642d\u5efamariadb\n1.\u5b89\u88c5\n2.\u542f\u52a8\n3.\u8fde\u63a5\u6d4b\u8bd5\n4.\u8bbe\u7f6e\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\u5bc6\u7801<\/code><\/pre>\n<h3>2.\u642d\u5efawordpress<\/h3>\n<pre><code class=\"language-bash\">1.\u914d\u7f6enginx\n2.\u521b\u5efa\u7ad9\u70b9\u76ee\u5f55\n3.\u4e0a\u4f20\u4ee3\u7801\u5305\n4.\u89e3\u538b\n5.\u6388\u6743\u4ee3\u7801\n6.\u91cd\u542fnginx\n7.\u914d\u7f6ehosts\u8bbf\u95ee\u6d4b\u8bd5\n8.\u6570\u636e\u5e93\u5efa\u5e93\n9.\u6839\u636e\u9875\u9762\u63d0\u793a\u914d\u7f6e\u6570\u636e\u5e93\u4fe1\u606f\n10.\u4f7f\u7528\u535a\u5ba2<\/code><\/pre>\n<h2>\u4e8c\u3001\u642d\u5efaLNMP<\/h2>\n<h3>1.\u914d\u7f6e\u5b98\u65b9\u6e90<\/h3>\n<pre><code class=\"language-bash\">[root@web01 ~]# cat \/etc\/yum.repos.d\/nginx.repo \n[nginx-stable]\nname=nginx stable repo\nbaseurl=http:\/\/nginx.org\/packages\/centos\/7\/$basearch\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/nginx.org\/keys\/nginx_signing.key\nmodule_hotfixes=true<\/code><\/pre>\n<h3>2.yum\u5b89\u88c5nginx<\/h3>\n<pre><code class=\"language-bash\">[root@web01 ~]# yum install -y nginx<\/code><\/pre>\n<h3>3.\u914d\u7f6enginx<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# vim \/etc\/nginx\/nginx.conf \nuser  www;\n...\nhttp {\n    client_max_body_size 200m;\n}<\/code><\/pre>\n<h3>4.\u521b\u5efa\u7528\u6237<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# groupadd www -g 666\n[root@web03 ~]# useradd www -u 666 -g 666 -s \/sbin\/nologin -M<\/code><\/pre>\n<h3>5.\u542f\u52a8<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# systemctl start nginx\n[root@web03 ~]# systemctl enable nginx<\/code><\/pre>\n<h3>6.\u4e0a\u4f20php\u5305<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# rz\n[root@web03 ~]# ll\n-rw-r--r--  1 root root 19889622 Nov 22 15:52 php.tar.gz<\/code><\/pre>\n<h3>7.\u5b89\u88c5<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# tar xf php.tar.gz \n[root@web03 ~]# yum localinstall -y *.rpm<\/code><\/pre>\n<h3>8.\u914d\u7f6ePHP<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# vim \/etc\/php-fpm.d\/www.conf \nuser = www\ngroup = www\n\n[root@web03 ~]# vim \/etc\/php.ini\nupload_max_filesize = 200M\npost_max_size = 200M<\/code><\/pre>\n<h3>9.\u542f\u52a8<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# systemctl start php-fpm\n[root@web03 ~]# systemctl enable php-fpm<\/code><\/pre>\n<h3>10.\u5b89\u88c5mariadb<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# yum install -y mariadb-server<\/code><\/pre>\n<h3>11.\u542f\u52a8<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# systemctl start mariadb\n[root@web03 ~]# systemctl enable mariadb<\/code><\/pre>\n<h3>12.\u8bbe\u7f6e\u6570\u636e\u5e93\u5bc6\u7801<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# mysqladmin -uroot password\nNew password: 123\nConfirm new password: 123<\/code><\/pre>\n<h3>13.\u4f7f\u7528\u5bc6\u7801\u8fde\u63a5\u6570\u636e\u5e93\u6d4b\u8bd5<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# mysql -uroot -p\nEnter password: 123<\/code><\/pre>\n<h2>\u4e09\u3001\u642d\u5efawordpress\u3001\u77e5\u4e4e\u3001edusoho<\/h2>\n<h3>1.\u4e0a\u4f20\u4ee3\u7801\u5305<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# mkdir \/code\n[root@web03 ~]# cd \/code\/\n[root@web03 code]# rz\n[root@web03 code]# ll\ntotal 86372\n-rw-r--r-- 1 root root 68889387 Dec  1 09:07 edusoho-8.3.36.tar.gz\n-rw-r--r-- 1 root root  8451194 Dec  1 09:07 WeCenter_3-2-1.zip\n-rw-r--r-- 1 root root 11098483 Sep 12 17:52 wordpress-5.0.3-zh_CN.tar.gz<\/code><\/pre>\n<h3>2.\u89e3\u538b\u4ee3\u7801\u5305<\/h3>\n<pre><code class=\"language-bash\">[root@web03 code]# tar xf edusoho-8.3.36.tar.gz\n[root@web03 code]# tar xf wordpress-5.0.3-zh_CN.tar.gz\n[root@web03 code]# unzip WeCenter_3-2-1.zip\n\n[root@web03 code]# mv WeCenter_3-2-1 zhihu\n\n[root@web03 code]# ll\ndrwxr-xr-x 10  501 games      115 Jul 18  2019 edusoho\ndrwxr-xr-x  5 1006  1006     4096 Jan 11  2019 wordpress\ndrwx------ 14 root root       296 Jun  4  2018 zhihu<\/code><\/pre>\n<h3>3.\u6388\u6743\u4ee3\u7801<\/h3>\n<pre><code class=\"language-bash\">[root@web03 code]# chown -R www.www \/code\/<\/code><\/pre>\n<h3>4.\u914d\u7f6enginx<\/h3>\n<h4>1\uff09\u914d\u7f6ewordpress\u7684nginx<\/h4>\n<pre><code class=\"language-bash\">[root@web03 ~]# vim \/etc\/nginx\/conf.d\/linux.wp.com.conf\nserver {\n    listen 80;\n    server_name linux.wp.com;\n\n    location \/ {\n        root \/code\/wordpress;\n        index index.php;\n    }\n\n    location ~* \\.php$ {\n        fastcgi_pass 127.0.0.1:9000;\n        fastcgi_param SCRIPT_FILENAME \/code\/wordpress\/$fastcgi_script_name;\n        include fastcgi_params;\n    }\n}<\/code><\/pre>\n<h4>2\uff09\u914d\u7f6e\u77e5\u4e4e\u7684nginx\u914d\u7f6e<\/h4>\n<pre><code class=\"language-bash\">[root@web03 ~]# vim \/etc\/nginx\/conf.d\/linux.zh.com.conf\nserver {\n    listen 80;\n    server_name linux.zh.com;\n    root \/code\/zhihu;\n\n    location \/ {\n        index index.php;\n    }\n\n    location ~* \\.php$ {\n        fastcgi_pass 127.0.0.1:9000;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        include fastcgi_params;\n    }\n}<\/code><\/pre>\n<h4>3\uff09\u914d\u7f6eedusoho\u7684nginx\u914d\u7f6e<\/h4>\n<pre><code class=\"language-bash\">server {\n \u00a0  listen 80;\n \u00a0  server_name linux.edu.com;\n \u00a0  root \/code\/edusoho\/web;\n \u00a0  \n \u00a0  location \/ {\n \u00a0      index app.php;\n \u00a0      try_files $uri @rewriteapp;\n \u00a0  }\n    location @rewriteapp {\n        rewrite ^(.*)$ \/app.php\/$1 last;\n    }\n    location ~ ^\/udisk {\n        internal;\n        root \/var\/www\/edusoho\/app\/data\/;\n    }\n    location ~ ^\/(app|app_dev)\\.php(\/|$) {\n \u00a0 \u00a0 \u00a0  fastcgi_pass \u00a0 127.0.0.1:9000;\n \u00a0 \u00a0 \u00a0  fastcgi_split_path_info ^(.+\\.php)(\/.*)$;\n \u00a0 \u00a0 \u00a0  include fastcgi_params;\n \u00a0 \u00a0 \u00a0  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n \u00a0 \u00a0 \u00a0  fastcgi_param HTTPS off;\n \u00a0 \u00a0 \u00a0  fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect;\n \u00a0 \u00a0 \u00a0  fastcgi_param HTTP_X-Accel-Mapping \/udisk=\/code\/edusoho\/app\/data\/udisk;\n \u00a0 \u00a0 \u00a0  fastcgi_buffer_size 128k;\n \u00a0 \u00a0 \u00a0  fastcgi_buffers 8 128k;\n \u00a0 \u00a0}\n \u00a0 \u00a0# \u914d\u7f6e\u8bbe\u7f6e\u56fe\u7247\u683c\u5f0f\u6587\u4ef6\n \u00a0 \u00a0location ~* \\.(jpg|jpeg|gif|png|ico|swf)$ {\n \u00a0 \u00a0    # \u8fc7\u671f\u65f6\u95f4\u4e3a3\u5e74\n \u00a0 \u00a0    expires 3y;\n \u00a0 \u00a0    # \u5173\u95ed\u65e5\u5fd7\u8bb0\u5f55\n \u00a0 \u00a0    access_log off;\n \u00a0 \u00a0    # \u5173\u95edgzip\u538b\u7f29\uff0c\u51cf\u5c11CPU\u6d88\u8017\uff0c\u56e0\u4e3a\u56fe\u7247\u7684\u538b\u7f29\u7387\u4e0d\u9ad8\u3002\n \u00a0 \u00a0    gzip off;\n \u00a0  }\n    # \u914d\u7f6ecss\/js\u6587\u4ef6\n    location ~* \\.(css|js)$ {\n        access_log off;\n        expires 3y;\n    }\n    # \u7981\u6b62\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u4e0b\u6240\u6709.php\u6587\u4ef6\u7684\u8bbf\u95ee\uff0c\u63d0\u9ad8\u5b89\u5168\u6027 \u00a0  \n    location ~ ^\/files\/.*\\.(php|php5)$ {\n        deny all;\n    }\n    # \u4ee5\u4e0b\u914d\u7f6e\u5141\u8bb8\u8fd0\u884c.php\u7684\u7a0b\u5e8f\uff0c\u65b9\u4fbf\u4e8e\u5176\u4ed6\u7b2c\u4e09\u65b9\u7cfb\u7edf\u7684\u96c6\u6210\u3002\n    location ~ \\.php$ {\n        # [\u6539] \u8bf7\u6839\u636e\u5b9e\u9645php-fpm\u8fd0\u884c\u7684\u65b9\u5f0f\u4fee\u6539\n        fastcgi_pass 127.0.0.1:9000;\n        fastcgi_split_path_info ^(.+\\.php)(\/.*)$;\n        include fastcgi_params;\n        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        fastcgi_param HTTPS off;\n    }\n}<\/code><\/pre>\n<h4>4\uff09\u91cd\u542fnginx<\/h4>\n<pre><code class=\"language-bash\">[root@web03 ~]# nginx -t\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful\n[root@web03 ~]# systemctl restart nginx<\/code><\/pre>\n<h3>5.\u914d\u7f6e\u672c\u5730hosts\u8bbf\u95ee\u6d4b\u8bd5<\/h3>\n<pre><code class=\"language-bash\">10.0.0.9 linux.wp.com linux.zh.com\n\n10.0.0.9 linux.wp.com \n10.0.0.9 linux.zh.com<\/code><\/pre>\n<h3>6.\u6570\u636e\u5e93\u5efa\u5e93<\/h3>\n<pre><code class=\"language-bash\">[root@web03 ~]# mysql -uroot -p\nEnter password: 123\n\nMariaDB [(none)]&gt; show databases;\n+--------------------+\n| Database           |\n+--------------------+\n| information_schema |\n| mysql              |\n| performance_schema |\n| test               |\n+--------------------+\n4 rows in set (0.01 sec)\n\nMariaDB [(none)]&gt; create database wordpress;\nQuery OK, 1 row affected (0.00 sec)\n\nMariaDB [(none)]&gt; create database zhihu;\nQuery OK, 1 row affected (0.00 sec)\n\nMariaDB [(none)]&gt; show databases;\n+--------------------+\n| Database           |\n+--------------------+\n| information_schema |\n| mysql              |\n| performance_schema |\n| test               |\n| wordpress          |\n| zhihu              |\n+--------------------+\n6 rows in set (0.00 sec)<\/code><\/pre>\n<h3>7.\u521b\u5efa\u6570\u636e\u5e93\u7528\u6237\u5e76\u6388\u6743<\/h3>\n<pre><code class=\"language-bash\">MariaDB [(none)]&gt; grant all on wordpress.* to wp@&#039;localhost&#039; identified by &#039;123&#039;;\nQuery OK, 0 rows affected (0.07 sec)\n\nMariaDB [(none)]&gt; grant all on zhihu.* to zh@&#039;localhost&#039; identified by &#039;123&#039;;\nQuery OK, 0 rows affected (0.00 sec)\n\n#\u67e5\u770b\u7528\u6237\nMariaDB [(none)]&gt; select user,host from mysql.user;\n+------+------------+\n| user | host       |\n+------+------------+\n| wp   | localhost |\n| zh   | localhost |\n+------+------------+\n8 rows in set (0.00 sec)<\/code><\/pre>\n<h3>8.\u6839\u636e\u9875\u9762\u63d0\u793a\u64cd\u4f5c<\/h3>\n<h2>\u56db\u3001\u62c6\u5206\u6570\u636e\u5e93<\/h2>\n<h3>1.\u4e3a\u4ec0\u4e48\u8981\u62c6\u5206<\/h3>\n<pre><code class=\"language-bash\">\u7531\u4e8e\u5355\u53f0\u670d\u52a1\u5668\u8fd0\u884cLNMP\u67b6\u6784\u4f1a\u5bfc\u81f4\u7f51\u7ad9\u8bbf\u95ee\u7f13\u6162\uff0c\u5f53\u5185\u5b58\u88ab\u5360\u6ee1\u65f6\uff0c\u5f88\u5bb9\u6613\u5bfc\u81f4\u7cfb\u7edf\u51fa\u73b0out of memory\u4ece\u800ckill\u6389MySQL\u6570\u636e\u5e93\uff0c\u6240\u4ee5\u8981\u5c06web\u548c\u6570\u636e\u5e93\u8fdb\u884c\u72ec\u7acb\u90e8\u7f72\u3002<\/code><\/pre>\n<h3>2.\u6570\u636e\u5e93\u62c6\u5206\u540e\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898<\/h3>\n<pre><code class=\"language-bash\">1.\u7f13\u89e3web\u7f51\u7ad9\u7684\u538b\u529b\n2.\u589e\u5f3a\u6570\u636e\u5e93\u8bfb\u5199\u6027\u80fd\n3.\u63d0\u9ad8\u7528\u6237\u8bbf\u95ee\u901f\u5ea6<\/code><\/pre>\n<h3>3.\u73af\u5883\u51c6\u5907<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u4e3b\u673a<\/th>\n<th>IP<\/th>\n<th>\u90e8\u7f72\u7684\u670d\u52a1<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>web01<\/td>\n<td>10.0.0.7,172.16.1.7<\/td>\n<td>nginx+php<\/td>\n<\/tr>\n<tr>\n<td>db01<\/td>\n<td>172.16.1.51<\/td>\n<td>mariadb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>4.\u5728\u65b0\u7684\u670d\u52a1\u5668\u4e0a\u642d\u5efa\u6570\u636e\u5e93\uff08\u76d6\u65b0\u623f\u5b50\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@db01 ~]# yum install -y mariadb-server<\/code><\/pre>\n<h3>5.\u914d\u7f6e\u6570\u636e\u5e93\u5bc6\u7801\uff08\u88c5\u4fee\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@db01 ~]# systemctl start mariadb\n[root@db01 ~]# mysqladmin -uroot password\nNew password: 123\nConfirm new password: 123<\/code><\/pre>\n<h3>6.\u6d4b\u8bd5\u8fde\u63a5\u8fdc\u7a0b\u6570\u636e\u5e93\uff08\u6d4b\u8bd5\u623f\u5b50\u80fd\u4e0d\u80fd\u4f4f\u4eba\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@web01 ~]# mysql -uroot -p -h 172.16.1.51\nEnter password: \nERROR 1130 (HY000): Host &#039;172.16.1.7&#039; is not allowed to connect to this MariaDB server\n\nmysql           #\u6570\u636e\u5e93\u547d\u4ee4\n-u              #\u6307\u5b9a\u7528\u6237\nroot            #root\u7528\u6237\n-p              #\u4f7f\u7528\u6570\u636e\u5e93root\u7528\u6237\u7684\u5bc6\u7801\n123             #\u6570\u636e\u5e93root\u7528\u6237\u7684\u5bc6\u7801\n-h              #\u6307\u5b9a\u6570\u636e\u5e93\u7684\u4e3b\u673a\n172.16.1.51     #\u4e3b\u673aIP<\/code><\/pre>\n<h3>7.\u6388\u6743\u7528\u6237\u8fdc\u7a0b\u8fde\u63a5\uff08\u60f3\u529e\u6cd5\u4f4f\uff09<\/h3>\n<pre><code class=\"language-bash\">MariaDB [(none)]&gt; create database wordpress;\nQuery OK, 1 row affected (0.00 sec)\n\nMariaDB [(none)]&gt; grant all on wordpress.* to wp@&#039;172.16.1.%&#039; identified by &#039;1qaz@WSX&#039;;\nQuery OK, 0 rows affected (0.00 sec)\n\ngrant               #\u6570\u636e\u5e93\u6388\u6743\u547d\u4ee4\nall                 #\u6240\u6709\u6743\u9650\non                  #\u5728...\u4e0a\u9762\nwordpress.*          #wordpress\u4e0b\u9762\u7684\u6240\u6709\u8868   \u5e93.\u8868\nto                  #\u7ed9...\nwp@&#039;172.16.1.%&#039;    #\u6570\u636e\u5e93\u7528\u6237\nidentified          #\u8bbe\u7f6e\u5bc6\u7801\nby                  #\u5bc6\u7801\u662f...\n&#039;1qaz@WSX&#039;;            #\u5bc6\u7801\u5185\u5bb9<\/code><\/pre>\n<h3>8.\u518d\u6b21\u6d4b\u8bd5\u8fde\u63a5\uff08\u623f\u5b50\u53ef\u4ee5\u4f4f\u4e86\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@web01 ~]# mysql -uwp -p -h 172.16.1.51\nEnter password: \nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 7\nServer version: 5.5.68-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType &#039;help;&#039; or &#039;\\h&#039; for help. Type &#039;\\c&#039; to clear the current input statement.\n\nMariaDB [(none)]&gt; show databases;\n+--------------------+\n| Database           |\n+--------------------+\n| information_schema |\n| test               |\n| wordpress          |\n+--------------------+\n3 rows in set (0.00 sec)<\/code><\/pre>\n<h3>9.\u65e7\u6570\u636e\u5e93\u5bfc\u51fa\u6570\u636e\uff08\u6253\u5305\u884c\u674e\u642c\u51fa\u623f\u5b50\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@web01 ~]# mysqldump -uroot -p -B wordpress &gt; \/tmp\/wp.sql\nEnter password: 123<\/code><\/pre>\n<h3>10.\u5c06\u6570\u636e\u63a8\u9001\u5230\u65b0\u670d\u52a1\u5668\uff08\u6c7d\u8f66\u8fd0\u9001\u884c\u674e\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@web01 ~]# scp \/tmp\/wp.sql 172.16.1.51:\/tmp\/<\/code><\/pre>\n<h3>11.\u5c06\u6570\u636e\u5bfc\u5165\u65b0\u6570\u636e\u5e93\uff08\u5c06\u884c\u674e\u653e\u5165\u65b0\u623f\u5b50\uff09<\/h3>\n<h4>1\uff09\u5e93\u5916\u5bfc\u5165<\/h4>\n<pre><code class=\"language-bash\">[root@db01 ~]# mysql -uroot -p &lt; \/tmp\/wp.sql \nEnter password: <\/code><\/pre>\n<h4>2\uff09\u5e93\u5185\u8bfb\u53d6<\/h4>\n<pre><code class=\"language-bash\">MariaDB [wordpress]&gt; source \/tmp\/wp.sql;<\/code><\/pre>\n<h4>3\uff09\u4efb\u610f\u95e8\u65b9\u5f0f\u5bfc\u6570\u636e<\/h4>\n<pre><code class=\"language-bash\">[root@web01 ~]# mysql -uwp -p -h 172.16.1.51 &lt; \/tmp\/wp.sql \nEnter password: 1qaz@WSX<\/code><\/pre>\n<h3>12.\u67e5\u770b\u6570\u636e<\/h3>\n<pre><code class=\"language-bash\">MariaDB [(none)]&gt; use wordpress;\nReading table information for completion of table and column names\nYou can turn off this feature to get a quicker startup with -A\n\nDatabase changed\nMariaDB [wordpress]&gt; show tables;\n+-----------------------+\n| Tables_in_wordpress   |\n+-----------------------+\n| wp_commentmeta        |\n| wp_comments           |\n| wp_links              |\n| wp_options            |\n| wp_postmeta           |\n| wp_posts              |\n| wp_term_relationships |\n| wp_term_taxonomy      |\n| wp_termmeta           |\n| wp_terms              |\n| wp_usermeta           |\n| wp_users              |\n+-----------------------+\n12 rows in set (0.00 sec)<\/code><\/pre>\n<h3>13.\u4fee\u6539\u9879\u76ee\u4e2d\u6570\u636e\u5e93\u5730\u5740\uff08\u544a\u77e5\u4eb2\u621a\u65b0\u5bb6\u5730\u5740\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@web01 ~]# vim \/code\/wordpress\/wp-config.php\n\/** WordPress\u6570\u636e\u5e93\u7684\u540d\u79f0 *\/\ndefine(&#039;DB_NAME&#039;, &#039;wordpress&#039;);\n\n\/** MySQL\u6570\u636e\u5e93\u7528\u6237\u540d *\/\ndefine(&#039;DB_USER&#039;, &#039;wp&#039;);\n\n\/** MySQL\u6570\u636e\u5e93\u5bc6\u7801 *\/\ndefine(&#039;DB_PASSWORD&#039;, &#039;1qaz@WSX&#039;);\n\n\/** MySQL\u4e3b\u673a *\/\ndefine(&#039;DB_HOST&#039;, &#039;172.16.1.51&#039;);\n\n[root@web03 ~]# vim \/code\/zhihu\/system\/config\/database.php<\/code><\/pre>\n<h3>14.\u505c\u6389\u65e7\u6570\u636e\u5e93\uff08\u62c6\u8fc1\u65e7\u5bb6\uff09<\/h3>\n<pre><code class=\"language-bash\">[root@web01 ~]# systemctl stop mariadb<\/code><\/pre>\n<h3>15.\u8bbf\u95ee\u9875\u9762\u6d4b\u8bd5<\/h3>\n<pre><code class=\"language-bash\">http:\/\/linux.wp.com\/<\/code><\/pre>\n<h2>\u4e94\u3001\u6269\u5c55web\u670d\u52a1\u5668<\/h2>\n<h3>1.\u73af\u5883\u51c6\u5907<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u4e3b\u673a<\/th>\n<th>IP<\/th>\n<th>\u90e8\u7f72\u670d\u52a1<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>web01<\/td>\n<td>10.0.0.7,172.16.1.7<\/td>\n<td>nginx+php<\/td>\n<\/tr>\n<tr>\n<td>web02<\/td>\n<td>10.0.0.8,172.16.1.8<\/td>\n<td>nginx+php<\/td>\n<\/tr>\n<tr>\n<td>db01<\/td>\n<td>172.16.1.51<\/td>\n<td>mariadb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>2.web02\u642d\u5efanginx<\/h3>\n<h4>1\uff09\u914d\u7f6e\u5b98\u65b9\u6e90<\/h4>\n<pre><code class=\"language-bash\">[root@web01 ~]# scp \/etc\/yum.repos.d\/nginx.repo 172.16.1.8:\/etc\/yum.repos.d\/<\/code><\/pre>\n<h4>2\uff09\u5b89\u88c5nginx<\/h4>\n<pre><code class=\"language-bash\">[root@web02 ~]# yum install -y nginx<\/code><\/pre>\n<h4>3\uff09\u521b\u5efa\u7528\u6237<\/h4>\n<pre><code class=\"language-bas\">[root@web02 ~]# groupadd www -g 666\n[root@web02 ~]# useradd www -u 666 -g 666<\/code><\/pre>\n<h4>4\uff09\u4e0a\u4f20php\u5305<\/h4>\n<pre><code class=\"language-bash\">[root@web02 ~]# rz<\/code><\/pre>\n<h4>5\uff09\u89e3\u538b\u5b89\u88c5php<\/h4>\n<pre><code class=\"language-bash\">[root@web02 ~]# tar xf php.tar.gz \n[root@web02 ~]# yum localinstall -y *.rpm<\/code><\/pre>\n<h4>6\uff09\u540c\u6b65web01\u7684\u914d\u7f6e\u6587\u4ef6\u5230web02<\/h4>\n<pre><code class=\"language-bash\">#\u540c\u6b65nginx\u914d\u7f6e\u6587\u4ef6\n[root@web01 ~]# scp \/etc\/nginx\/nginx.conf 172.16.1.8:\/etc\/nginx\/ \n[root@web01 ~]# scp \/etc\/nginx\/conf.d\/linux.wp.com.conf 172.16.1.8:\/etc\/nginx\/conf.d\/\n\n#\u540c\u6b65php\u7684\u914d\u7f6e\n[root@web01 ~]# scp \/etc\/php-fpm.d\/www.conf 172.16.1.8:\/etc\/php-fpm.d\/ \n[root@web01 ~]# scp \/etc\/php.ini 172.16.1.8:\/etc\/<\/code><\/pre>\n<h4>7\uff09\u542f\u52a8nginx\u548cphp\u670d\u52a1<\/h4>\n<pre><code class=\"language-bash\">[root@web02 ~]# systemctl start nginx\n[root@web02 ~]# systemctl enable nginx\n[root@web02 ~]# systemctl start php-fpm\n[root@web02 ~]# systemctl enable php-fpm<\/code><\/pre>\n<h4>8\uff09\u63a8\u9001web01\u7ad9\u70b9\u76ee\u5f55\u5230web02<\/h4>\n<pre><code class=\"language-bash\">[root@web01 ~]# scp -r \/code 172.16.1.8:\/<\/code><\/pre>\n<h4>9\uff09\u6388\u6743\u7ad9\u70b9\u76ee\u5f55<\/h4>\n<pre><code class=\"language-bash\">[root@web02 ~]# chown -R www.www \/code\/<\/code><\/pre>\n<h4>10\uff09\u4fee\u6539\u672c\u5730hosts\u8bbf\u95ee\u6d4b\u8bd5<\/h4>\n<pre><code class=\"language-bash\">#10.0.0.7 linux.wp.com\n10.0.0.8 linux.wp.com<\/code><\/pre>\n<h2>\u516d\u3001\u642d\u5efa\u6587\u4ef6\u5171\u4eab<\/h2>\n<h3>1.\u73af\u5883\u51c6\u5907<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u4e3b\u673a<\/th>\n<th>IP<\/th>\n<th>\u90e8\u7f72\u670d\u52a1<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>web01<\/td>\n<td>10.0.0.7<\/td>\n<td>nginx+php<\/td>\n<\/tr>\n<tr>\n<td>web02<\/td>\n<td>10.0.0.8<\/td>\n<td>nginx+php<\/td>\n<\/tr>\n<tr>\n<td>db01<\/td>\n<td>172.16.1.51<\/td>\n<td>mariadb<\/td>\n<\/tr>\n<tr>\n<td>nfs<\/td>\n<td>172.16.1.31<\/td>\n<td>nfs<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>2.\u642d\u5efaNFS\u670d\u52a1\u5668<\/h3>\n<h4>1\uff09\u5b89\u88c5nfs<\/h4>\n<pre><code class=\"language-bash\">[root@nfs ~]# yum install -y nfs-utils<\/code><\/pre>\n<h4>2\uff09\u521b\u5efa\u6302\u8f7d\u76ee\u5f55<\/h4>\n<pre><code class=\"language-bash\">[root@nfs ~]# mkdir \/data\/wp -p<\/code><\/pre>\n<h4>3\uff09\u914d\u7f6eNFS<\/h4>\n<pre><code class=\"language-bash\">[root@nfs ~]# vim \/etc\/exports\n\/data\/wp 172.16.1.0\/24(rw,sync,all_squash,anonuid=666,anongid=666)<\/code><\/pre>\n<h4>4\uff09\u521b\u5efa\u7528\u6237<\/h4>\n<h4>5\uff09\u6388\u6743<\/h4>\n<pre><code class=\"language-bash\">[root@nfs ~]# chown -R www.www \/data\/<\/code><\/pre>\n<h4>6\uff09\u542f\u52a8NFS<\/h4>\n<pre><code class=\"language-bash\">[root@nfs ~]# systemctl start nfs<\/code><\/pre>\n<h4>7\uff09\u68c0\u67e5\u914d\u7f6e<\/h4>\n<pre><code class=\"language-bash\">[root@nfs ~]# cat \/var\/lib\/nfs\/etab \n\/data\/wp    172.16.1.0\/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=666,anongid=666,sec=sys,rw,secure,root_squash,all_squash)<\/code><\/pre>\n<h3>3.\u914d\u7f6e\u5ba2\u6237\u7aef<\/h3>\n<h4>1\uff09\u5b89\u88c5nfs\u548crpcbind<\/h4>\n<pre><code class=\"language-bash\">[root@web01 ~]# yum install -y nfs-utils rpcbind<\/code><\/pre>\n<h4>2\uff09\u542f\u52a8rpcbind<\/h4>\n<h4>3\uff09\u67e5\u770b\u6302\u8f7d\u70b9<\/h4>\n<pre><code class=\"language-bash\">[root@web01 ~]# showmount -e 172.16.1.31\nExport list for 172.16.1.31:\n\/data\/wp 172.16.1.0\/24<\/code><\/pre>\n<h4>4\uff09\u786e\u5b9a\u6302\u8f7d\u76ee\u5f55<\/h4>\n<pre><code class=\"language-bash\">[root@web01 ~]# ll \/code\/wordpress\/wp-content\/uploads\/<\/code><\/pre>\n<h4>5\uff09\u5148\u63a8\u9001\u6302\u8f7d\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6<\/h4>\n<pre><code class=\"language-bash\">[root@web01 ~]# rsync -avz \/code\/wordpress\/wp-content\/uploads\/ 172.16.1.31:\/data\/wp\/\n[root@web02 ~]# rsync -avz \/code\/wordpress\/wp-content\/uploads\/ 172.16.1.31:\/data\/wp\/\n\n#\u9a8c\u8bc1\u6587\u4ef6\n[root@nfs ~]# ll \/data\/wp\/2020\/12\/<\/code><\/pre>\n<h4>6\uff09\u6302\u8f7d<\/h4>\n<pre><code class=\"language-bash\">[root@web01 ~]# mount -t nfs 172.16.1.31:\/data\/wp \/code\/wordpress\/wp-content\/uploads\n[root@web02 ~]# mount -t nfs 172.16.1.31:\/data\/wp \/code\/wordpress\/wp-content\/uploads<\/code><\/pre>\n<h2>\u4e03\u3001\u5b9e\u65f6\u5907\u4efd<\/h2>\n<h2>\u4f5c\u4e1a\uff1a<\/h2>\n<pre><code class=\"language-bash\">1.\u6062\u590d\u5feb\u7167\n2.\u642d\u5efalnmp\u67b6\u6784\n3.\u642d\u5efa\u535a\u5ba2\u4e0e\u77e5\u4e4e\n4.\u4e24\u53f0web\u670d\u52a1\u5668\u5b9e\u73b0\u6587\u4ef6\u540c\u6b65\n5.nfs\u6587\u4ef6\u5b9e\u65f6\u5907\u4efd\u5230backup<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>nfs\u4e00\u3001\u56de\u987e 1.\u642d\u5efaLNMP\u73af\u5883 #\u642d\u5efanginx 1.\u914d\u7f6eyum\u6e90 2.\u5b89\u88c5nginx 3.\u914d\u7f6engin [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":254,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[21,19,58,22,57,20],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/325"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=325"}],"version-history":[{"count":1,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/325\/revisions"}],"predecessor-version":[{"id":8763,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/325\/revisions\/8763"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/254"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}