{"id":854,"date":"2022-08-17T12:07:21","date_gmt":"2022-08-17T04:07:21","guid":{"rendered":"https:\/\/www.qiangzhenshuai.com\/?p=854"},"modified":"2022-09-14T20:10:39","modified_gmt":"2022-09-14T12:10:39","slug":"nginx-lnmp","status":"publish","type":"post","link":"https:\/\/www.qiangzhenshuai.com\/?p=854","title":{"rendered":"NGINX-LNMP"},"content":{"rendered":"<h1>1.\u4ec0\u4e48\u662fLNMP<\/h1>\n<p>LNMP \u662f\u4e00\u5957\u6280\u672f\u7684\u7ec4\u5408\uff0c L=Linux\u3001 N=Nginx\u3001 M=MySQL\u3001 P=PHP<\/p>\n<h1>2.\u5e38\u89c1\u7684\u67b6\u6784<\/h1>\n<p>LAMP\uff1aLInux Apache MySQL(MariaDB) PHP (Fastcgi)<\/p>\n<p>LNMP\/LEMP\uff1aLInux Nginx MySQL(MariaDB) PHP(Fastcgi)<\/p>\n<p>LNMT\uff1aLinux Nginx MySQL Tomcat\/Jboss\/Resin\/(java)Weblogic(\u914d\u5408Oracle\u6570\u636e\u5e93)<\/p>\n<p>LNMP\uff1aLinux Nginx MySQL Python (Uwsgi)<\/p>\n<p>LNM???\uff1aLinux Nginx MySQL \u5f00\u53d1<\/p>\n<h1>3.LNMP\u539f\u7406<\/h1>\n<p><a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=858\" rel=\"attachment wp-att-858\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-858\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/LNMP\u539f\u7406.jpg?resize=640%2C197&#038;ssl=1\" alt=\"\" width=\"640\" height=\"197\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/LNMP\u539f\u7406.jpg?w=1886&amp;ssl=1 1886w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/LNMP\u539f\u7406.jpg?resize=300%2C92&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/LNMP\u539f\u7406.jpg?resize=1024%2C315&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/LNMP\u539f\u7406.jpg?resize=768%2C236&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/LNMP\u539f\u7406.jpg?resize=1536%2C472&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/LNMP\u539f\u7406.jpg?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>\u7528\u6237\u53d1\u51fa\u8bf7\u6c42\u540e,\u8bf7\u6c42\u5230\u8fbenginx<br \/>\n\u5982\u679c\u662f\u9759\u6001\u8bf7\u6c42,nginx\u81ea\u5df1\u5904\u7406<br \/>\n\u5982\u679c\u662f\u52a8\u6001\u8bf7\u6c42nginx \u6839\u636e \u8bf7\u6c42\u7c7b\u578b(php) \u901a\u8fc7fastcgi_pass \u52a8\u6001\u8bf7\u6c42\u4ea4\u7ed9 php-fpm(fastcgi)<br \/>\nphp-fpm\u6536\u5230\u8bf7\u6c42\u540e,\u4f20\u9012\u7ed9php\u89e3\u91ca\u5668(\u4e0e\u6570\u636e\u5e93\u4ea4\u4e92)<br \/>\n\u89e3\u91ca\u540e\u628a\u7ed3\u679c\u4f20\u9012\u7ed9\u7528\u6237(\u89e3\u91ca\u5668&#8211;&gt;php-fpm&#8212;&gt;nginx&#8212;&gt;\u7528\u6237)<br \/>\n\u5b8c\u6210\u52a8\u6001\u8bf7\u6c42\u8fc7\u7a0b<\/p>\n<p>php-fpm.conf \u914d\u7f6e\u63a7\u5236php-fpm\u8fdb\u7a0b<br \/>\nphp.ini \u63a7\u5236\u89e3\u91ca\u5668<\/p>\n<h1>4.\u4ec0\u4e48\u662fFastCGI<\/h1>\n<p>FastCGI\u662f\u4e00\u4e2a\u53ef\u4f38\u7f29\u5730\u3001\u9ad8\u901f\u5730\u5728http server\u548c\u52a8\u6001\u811a\u672c\u8bed\u8a00\u95f4\u901a\u4fe1\u7684\u63a5\u53e3\uff08FastCGI\u63a5\u53e3\u5728Linux\u4e0b\u662fsocket\uff0c\u8fd9\u4e2asocket\u53ef\u4ee5\u662f\u6587\u4ef6socket\uff0c\u4e5f\u53ef\u4ee5\u662fip socket\uff09\uff0c\u4e3b\u8981\u4f18\u70b9\u662f\u628a\u52a8\u6001\u8bed\u8a00\u548cHTTP Server\u5206\u79bb\u5f00\u6765\u3002\u591a\u6570\u6d41\u884c\u7684HTTP server\u90fd\u652f\u6301FastCGI\u5305\u62ecNginx\u548cLighttpd\u7b49\uff0c\u540c\u65f6FastCGI\u4e5f\u88ab\u8bb8\u591a\u811a\u672c\u8bed\u8a00\u6240\u652f\u6301\uff0c\u5176\u4e2d\u5c31\u6709PHP\u3002FastCGI\u63a5\u53e3\u65b9\u5f0f\u91c7\u7528C\/S\u7ed3\u6784\uff0c\u53ef\u4ee5\u5c06http\u670d\u52a1\u5668\u548c\u811a\u672c\u89e3\u6790\u670d\u52a1\u5668\u5206\u5f00\uff0c\u540c\u65f6\u5728\u811a\u672c\u89e3\u6790\u670d\u52a1\u5668\u4e0a\u542f\u52a8\u4e00\u4e2a\u6216\u8005\u591a\u4e2a\u811a\u672c\u89e3\u6790\u5b88\u62a4\u8fdb\u7a0b\u3002\u5f53http\u670d\u52a1\u5668\u6bcf\u6b21\u9047\u5230\u52a8\u6001\u7a0b\u5e8f\u65f6\uff0c\u53ef\u4ee5\u5c06\u5176\u76f4\u63a5\u4ea4\u4ed8\u7ed9FastCGI\u8fdb\u7a0b\u6765\u6267\u884c\uff0c\u7136\u540e\u5c06\u5f97\u5230\u7684\u7ed3\u679c\u8fd4\u56de\u7ed9\u6d4f\u89c8\u5668\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u8ba9http\u670d\u52a1\u5668\u4e13\u4e00\u5730\u5904\u7406\u9759\u6001\u8bf7\u6c42\u6216\u8005\u5c06\u52a8\u6001\u811a\u672c\u670d\u52a1\u5668\u7684\u7ed3\u679c\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\uff0c\u8fd9\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u63d0\u9ad8\u4e86\u6574\u4e2a\u5e94\u7528\u7cfb\u7edf\u7684\u6027\u80fd<\/p>\n<h1>5.Nginx\u4e0bFastCGI\u8fd0\u884c\u539f\u7406<\/h1>\n<p>Nginx\u4e0d\u652f\u6301\u5bf9\u5916\u90e8\u7a0b\u5e8f\u7684\u76f4\u63a5\u8c03\u7528\u6216\u8005\u89e3\u6790\uff0c\u6240\u6709\u7684\u5916\u90e8\u7a0b\u5e8f\uff08\u5305\u62ecPHP\uff09\u5fc5\u987b\u901a\u8fc7FastCGI\u63a5\u53e3\u6765\u8c03\u7528\u3002FastCGI\u63a5\u53e3\u5728Linux\u4e0b\u662fsocket\uff08\u8fd9\u4e2asocket\u53ef\u4ee5\u662f\u6587\u4ef6socket\uff0c\u4e5f\u53ef\u4ee5\u662fIP socket\uff09\u3002\u4e3a\u4e86\u8c03\u7528CGI\u7a0b\u5e8f\uff0c\u8fd8\u9700\u8981\u4e00\u4e2aFastCGI\u7684wrapper\uff08wrapper\u53ef\u4ee5\u7406\u89e3\u4e3a\u7528\u4e8e\u542f\u52a8\u53e6\u5916\u4e00\u4e2a\u7a0b\u5e8f\u7684\u7a0b\u5e8f\uff09\uff0c\u8fd9\u4e2awrapper\u7ed1\u5b9a\u5728\u67d0\u4e2a\u56fa\u5b9asocket\u4e0a\uff0c\u5982\u7aef\u53e3\u6216\u8005\u6587\u4ef6socket\u3002\u5f53Nginx\u5c06CGI\u8bf7\u6c42\u53d1\u9001\u7ed9\u8fd9\u4e2asocket\u7684\u65f6\u5019\uff0c\u901a\u8fc7FastCGI\u63a5\u53e3\uff0cwrapper\u63a5\u7eb3\u5230\u8bf7\u6c42\uff0c\u7136\u540e\u6d3e\u751f\u51fa\u4e00\u4e2a\u65b0\u7684\u7ebf\u7a0b\uff0c\u8fd9\u4e2a\u7ebf\u7a0b\u8c03\u7528\u89e3\u91ca\u5668\u6216\u8005\u5916\u90e8\u7a0b\u5e8f\u5904\u7406\u811a\u672c\u5e76\u8bfb\u53d6\u8fd4\u56de\u6570\u636e\uff0c\u63a5\u7740\uff0cwrapper\u518d\u5c06\u8fd4\u56de\u7684\u6570\u636e\u901a\u8fc7FastCGI\u63a5\u53e3\uff0c\u6cbf\u7740\u56fa\u5b9a\u7684socket\u4f20\u9012\u7ed9Nginx\uff0c\u6700\u540eNginx\u5c06\u8fd4\u56de\u7684\u6570\u636e\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\uff0c\u8fd9\u5c31\u662fNginx+FastCGI\u7684\u6574\u4e2a\u8fd0\u4f5c\u8fc7\u7a0b<\/p>\n<h1>6.\u9759\u6001vs\u52a8\u6001<\/h1>\n<h2>\u9759\u6001\u8d44\u6e90<\/h2>\n<p>\u670d\u52a1\u5668\u7aef\u7684\u6587\u4ef6\u4ece\u670d\u52a1\u5668\u7aef\u4f20\u7ed9\u6d4f\u89c8\u5668\u4e4b\u540e\uff0c\u5982\u679c\u5728\u6d4f\u89c8\u5668\u4e0a\u770b\u5230\u7684\u9875\u9762\u5185\u5bb9\u548c\u670d\u52a1\u5668\u7aef\u4e00\u6a21\u4e00\u6837\uff0c\u5c31\u662f\u5c5e\u4e8e\u9759\u6001\u8d44\u6e90\uff0c\u8fd9\u91cc\u9762\u5305\u542bHTML\u3001CSS\u3001JS\u3001\u56fe\u7247\u7b49\u7b49\uff0c\u4e0d\u9700\u8981\u67e5\u6570\u636e\u5e93\u4e5f\u4e0d\u9700\u8981\u7a0b\u5e8f\u5904\u7406\uff0c\u76f4\u63a5\u5c31\u80fd\u591f\u663e\u793a\u7684\u9875\u9762(*.htm\u6216\u8005\u662f*.htm)<\/p>\n<h2>\u52a8\u6001\u8d44\u6e90<\/h2>\n<p>\u670d\u52a1\u5668\u7aef\u4f1a\u628a\u7a0b\u5e8f\u52a8\u6001\u8fd0\u884c\u8d77\u6765\uff0c\u8fd0\u884c\u5b8c\u4ee5\u540e\u4f1a\u628a\u7a0b\u5e8f\u7684\u6267\u884c\u7ed3\u679c\u53d1\u8fd8\u7ed9\u5ba2\u6237\u7aef \uff0c\u5ba2\u6237\u7aef\u770b\u5230\u7684\u53ea\u662f\u4e00\u4e2a\u7ed3\u679c\uff0c\u770b\u4e0d\u5230\u6e90\u7a0b\u5e8f\u3002\u5ba2\u6237\u7aef\u8bf7\u6c42\u7684\u52a8\u6001\u8d44\u6e90\uff0c\u5148\u628a\u8bf7\u6c42\u4ea4\u7ed9web\u7684\u4e00\u4e2a\u5b58\u50a8\u70b9\uff0cweb\u5b58\u50a8\u70b9\u8fde\u63a5\u6570\u636e\u5e93\uff0c\u6570\u636e\u5e93\u5904\u7406\u6570\u636e\u4e4b\u540e\uff0c\u5c06\u6570\u636e\u4ea4\u7ed9web\u670d\u52a1\u5668\uff0cweb\u670d\u52a1\u5668\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u89e3\u6790\u6e32\u67d3\u5904\u7406\u3002\u4ea4\u4e92\u5185\u5bb9(\u8bc4\u8bba,\u53d1\u5e03\u6587\u7ae0,\u8ba2\u5355,\u91d1\u94b1) url\u8fde\u63a5\u4e2d \u5305\u542b\u7279\u6b8a\u7b26\u53f7 &amp; \u7b26\u53f7 \u6216 ? \u7b26\u53f7\uff08*.jsp\u3001*.asp\/*.aspx\u3001*.php\uff09<\/p>\n<h2>\u533a\u522b<\/h2>\n<p>\u9759\u6001\u8d44\u6e90\u4e00\u822c\u90fd\u662f\u8bbe\u8ba1\u597d\u7684html\u9875\u9762\uff0c\u800c\u52a8\u6001\u8d44\u6e90\u4f9d\u9760\u8bbe\u8ba1\u597d\u7684\u7a0b\u5e8f\u6765\u5b9e\u73b0\u6309\u7167\u9700\u6c42\u7684\u52a8\u6001\u54cd\u5e94\u6216\u8005\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u6570\u636e<\/p>\n<p>\u9759\u6001\u8d44\u6e90\u7684\u4ea4\u4e92\u6027\u5dee\uff0c\u4e0d\u597d\u66f4\u6539\uff0c\u800c\u52a8\u6001\u8d44\u6e90\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u83b7\u53d6\u5185\u5bb9<\/p>\n<p>\u5728\u670d\u52a1\u5668\u7684\u8fd0\u884c\u72b6\u6001\u4e0d\u540c\uff0c\u9759\u6001\u8d44\u6e90\u4e0d\u9700\u8981\u4e0e\u6570\u636e\u5e93\u53c2\u4e8e\u7a0b\u5e8f\u5904\u7406\uff0c\u52a8\u6001\u8d44\u6e90\u9700\u8981\u4e00\u4e2a\u6216\u591a\u4e2a\u6570\u636e\u5e93\u7684\u53c2\u4e0e\u8fd0\u7b97<\/p>\n<h1>7.\u73af\u5883\u51c6\u5907<\/h1>\n<h2>nginx<\/h2>\n<h4>\u5b89\u88c5nginx<\/h4>\n<p>[root@web01 ~]$ yum install nginx -y<br \/>\n[root@web01 ~]$ systemctl start nginx<br \/>\n[root@web01 ~]$ systemctl enable nginx<\/p>\n<h4>\u5199web\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>[root@web01 ~]$ cat \/etc\/nginx\/conf.d\/dmxsp.blog.com.conf<br \/>\nserver {<br \/>\nlisten 80;<br \/>\nserver_name dmxsp.blog.com;<br \/>\nroot \/code\/blog;<br \/>\nlocation \/ {<br \/>\nindex index.html index.php;<br \/>\n}<\/p>\n<p>location ~ \\.php {<br \/>\nfastcgi_pass 127.0.0.1:9000;<br \/>\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br \/>\ninclude fastcgi_params;<br \/>\n}<br \/>\n}<\/p>\n<p>fastcgi_param\uff1a\u4fee\u6539\u6216\u8bbe\u7f6e nginx \u5411php\u53d1\u9001\u7684\u6570\u636e\u5305<br \/>\nSCRIPT_FILENAME\uff1a\u4fee\u6539\u540e\u7684\u683c\u5f0f\uff0c\u8fd9\u662fPHP\u5185\u7f6e\u53d8\u91cf<br \/>\n$document_root\uff1a\u7ad9\u70b9\u76ee\u5f55(\u7f51\u7ad9) root<br \/>\n$fastcgi_script_name\uff1auri \u7528\u6237\u8bf7\u6c42uri<\/p>\n<h4>\u68c0\u67e5\u8bed\u6cd5<\/h4>\n<p>[root@web01 ~]$ nginx -t<br \/>\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok<br \/>\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/p>\n<h4>\u91cd\u542fnginx<\/h4>\n<p>[root@web01 ~]$ systemctl reload nginx.service<\/p>\n<h4>\u521b\u5efa\u76ee\u5f55<\/h4>\n<p>[root@web01 ~]$ mkdir -p \/code\/blog<\/p>\n<h2>mysql\u6570\u636e\u5e93<\/h2>\n<h4>\u5b89\u88c5\u6570\u636e\u5e93<\/h4>\n<p>[root@web01 ~]$ yum install mariadb-server -y<\/p>\n<p>[root@web01 ~]$ systemctl start mariadb.service<br \/>\n[root@web01 ~]$ systemctl enable mariadb.service<\/p>\n<h4>\u68c0\u67e5\u662f\u5426\u6b63\u5e38\u542f\u52a8\uff08\u8fdb\u7a0b\u3001\u7aef\u53e3\uff09<\/h4>\n<p>[root@web01 ~]$ ss -lntup | grep mysql<br \/>\ntcp LISTEN 0 50 *:3306 *:* users:((&#8220;mysqld&#8221;,pid=101700,fd=14))<\/p>\n<p>[root@web01 ~]$ ps -ef | grep mysql<br \/>\nmysql 101535 1 0 16:17 ? 00:00:00 \/bin\/sh \/usr\/bin\/mysqld_safe &#8211;basedir=\/usr<br \/>\nmysql 101700 101535 0 16:17 ? 00:00:00 \/usr\/libexec\/mysqld &#8211;basedir=\/usr &#8211;datadir=\/var\/lib\/mysql &#8211;plugin-dir=\/usr\/lib64\/mysql\/plugin &#8211;log-error=\/var\/log\/mariadb\/mariadb.log &#8211;pid-file=\/var\/run\/mariadb\/mariadb.pid &#8211;socket=\/var\/lib\/mysql\/mysql.sock<\/p>\n<h4>\u767b\u5f55mysql\uff0c\u5e76\u8bbe\u7f6e\u5bc6\u7801<\/h4>\n<p>[root@web01 ~]$ mysql<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 2<br \/>\nServer version: 5.5.68-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt;<\/p>\n<h4>ctrl+d\uff1a\u9000\u51fa<\/h4>\n<p>[root@web01 ~]$ mysqladmin -u root password &#8216;123&#8217;<\/p>\n<h3>\u8fdb\u5165mysql\u4e24\u79cd\u65b9\u5f0f<\/h3>\n<h4>\u547d\u4ee4\u884c<\/h4>\n<p>[root@web01 ~]$ mysql -uroot -p123<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 9<br \/>\nServer version: 5.5.68-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt; Bye<\/p>\n<h4>\u4ea4\u4e92\u5f0f<\/h4>\n<p>[root@web01 ~]$ mysql -uroot -p<br \/>\nEnter password:<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 10<br \/>\nServer version: 5.5.68-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt; Bye<\/p>\n<h4>\u67e5\u770b\u6240\u6709\u6570\u636e\u5e93<\/h4>\n<p>MariaDB [(none)]&gt; show databases;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| Database |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| information_schema |<br \/>\n| mysql |<br \/>\n| performance_schema |<br \/>\n| test |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n4 rows in set (0.00 sec)<\/p>\n<h4>\u67e5\u770b\u8868<\/h4>\n<p>MariaDB [(none)]&gt; show tables from mysql;<\/p>\n<h4>\u8fdb\u5165\u76ee\u5f55<\/h4>\n<p>MariaDB [(none)]&gt; use mysql;<br \/>\nReading table information for completion of table and column names<br \/>\nYou can turn off this feature to get a quicker startup with -A<\/p>\n<p>Database changed<br \/>\nMariaDB [mysql]&gt;<\/p>\n<h4>\u8be6\u7ec6\u4fe1\u606f<\/h4>\n<p>MariaDB [mysql]&gt; show tables;<\/p>\n<h4>\u67e5\u770b\u8868\u4e2d\u6570\u636e<\/h4>\n<p>MariaDB [mysql]&gt; select user,host from mysql.user;<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n| user | host |<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n| root | 127.0.0.1 |<br \/>\n| root | ::1 |<br \/>\n| | localhost |<br \/>\n| root | localhost |<br \/>\n| | web01 |<br \/>\n| root | web01 |<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n6 rows in set (0.01 sec)<\/p>\n<p>select \u5b57\u6bb5(\u5217) \u00a0 from \u6570\u636e\u5e93.\u8868<\/p>\n<h2>php\u73af\u5883\u51c6\u5907<\/h2>\n<h4>\u914d\u7f6e\u6e90<\/h4>\n<p>[root@web01 ~]$ rpm -Uvh https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-7.noarch.rpm<\/p>\n<p>[root@web01 ~]$ rpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm<\/p>\n<h4>\u5b89\u88c5<\/h4>\n<p>[root@web01 ~]$ yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-pdo php72w-xml php72w-fpm php72w-mysqlnd php72w-opcache php72w-pecl-redis<\/p>\n<h4>\u542f\u52a8<\/h4>\n<p>[root@web01 ~]$ systemctl start php-fpm.service<br \/>\n[root@web01 ~]$ systemctl enable php-fpm.service<\/p>\n<h4>\u67e5\u770b\u7aef\u53e3<\/h4>\n<p>[root@web01 ~]$ ss -lntup | grep php<br \/>\ntcp LISTEN 0 128 127.0.0.1:9000 *:* users:((&#8220;php-fpm&#8221;,pid=112914,fd=9),(&#8220;php-fpm&#8221;,pid=112913,fd=9),(&#8220;php-fpm&#8221;,pid=112912,fd=9),(&#8220;php-fpm&#8221;,pid=112911,fd=9),(&#8220;php-fpm&#8221;,pid=112910,fd=9),(&#8220;php-fpm&#8221;,pid=112909,fd=7))<\/p>\n<p>[root@web01 ~]$ ps aux | grep php<\/p>\n<h4>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>[root@web01 ~]$ egrep -n &#8216;^user|^group&#8217; \/etc\/php-fpm.d\/www.conf<br \/>\n8:user = nginx<br \/>\n10:group = nginx<\/p>\n<h4>\u91cd\u542f<\/h4>\n<p>[root@web01 ~]$ systemctl reload php-fpm.service<\/p>\n<h1>8.\u68c0\u67e5 lnmp\u662f\u5426\u53ef\u7528<\/h1>\n<h2>nginx+php<\/h2>\n<h4>\u5199\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>[root@web01 ~]$ cat \/code\/blog\/info.php<br \/>\n&lt;?php<br \/>\nphpinfo();<br \/>\n?&gt;<\/p>\n<h4>\u6d4b\u8bd5<\/h4>\n<p><a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=865\" rel=\"attachment wp-att-865\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-865\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/nginxphp\u6d4b\u8bd5.png?resize=640%2C359&#038;ssl=1\" alt=\"\" width=\"640\" height=\"359\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/nginxphp\u6d4b\u8bd5.png?w=1484&amp;ssl=1 1484w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/nginxphp\u6d4b\u8bd5.png?resize=300%2C168&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/nginxphp\u6d4b\u8bd5.png?resize=1024%2C574&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/nginxphp\u6d4b\u8bd5.png?resize=768%2C431&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/nginxphp\u6d4b\u8bd5.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h2>php+\u6570\u636e\u5e93<\/h2>\n<h4>\u5199\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>[root@web01 ~]$ cat \/code\/blog\/mysql.php<br \/>\n&lt;?php<br \/>\n\/\/$link_id=mysqli_connect(&#8216;\u4e3b\u673a\u540d&#8217;,&#8217;\u7528\u6237&#8217;,&#8217;\u5bc6\u7801&#8217;);<\/p>\n<p>$link_id=mysqli_connect(&#8216;localhost&#8217;,&#8217;root&#8217;,&#8217;123&#8242;) or<br \/>\nmysqli_error();<br \/>\n\/\/$link_id=mysqli_connect(&#8216;localhost&#8217;,&#8217;test&#8217;,&#8221;);<br \/>\nif($link_id){<br \/>\necho &#8220;mysql+php cs !&#8221;;<br \/>\n}else{<br \/>\necho mysqli_error();<br \/>\n}<br \/>\n\/\/\u8fd9\u662fphp\u5355\u884c\u6ce8\u91ca<br \/>\n\/* \u8fd9\u662fphp\u591a\u884c\u6ce8\u91ca *\/<br \/>\n?&gt;<\/p>\n<p>[root@web01 ~]$ cat \/code\/blog\/mysqll.php<br \/>\n&lt;?php<br \/>\n$servername = &#8220;localhost&#8221;;<br \/>\n$username = &#8220;root&#8221;;<br \/>\n$password = &#8220;123&#8221;;<\/p>\n<p>\/\/ \u521b\u5efa\u8fde\u63a5<br \/>\n$conn = mysqli_connect($servername, $username, $password);<\/p>\n<p>\/\/ \u68c0\u6d4b\u8fde\u63a5<br \/>\nif (!$conn) {<br \/>\ndie(&#8220;Connection failed: &#8221; . mysqli_connect_error());<br \/>\n}<br \/>\necho &#8220;\u8fde\u63a5\u6210\u529f&#8221;;<br \/>\n?&gt;<\/p>\n<h4>\u6d4b\u8bd5<\/h4>\n<p><a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=866\" rel=\"attachment wp-att-866\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-866\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/php\u6570\u636e\u5e93\u6d4b\u8bd5.png?resize=640%2C367&#038;ssl=1\" alt=\"\" width=\"640\" height=\"367\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/php\u6570\u636e\u5e93\u6d4b\u8bd5.png?w=1233&amp;ssl=1 1233w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/php\u6570\u636e\u5e93\u6d4b\u8bd5.png?resize=300%2C172&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/php\u6570\u636e\u5e93\u6d4b\u8bd5.png?resize=1024%2C588&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/php\u6570\u636e\u5e93\u6d4b\u8bd5.png?resize=768%2C441&amp;ssl=1 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h1>9.\u5b89\u88c5wordpress<\/h1>\n<h2><a href=\"https:\/\/wordpress.org\/download\/\">\u5b98\u7f51<\/a><\/h2>\n<h4>\u4e0b\u8f7d<\/h4>\n<p>[root@web01 ~]$ wget https:\/\/wordpress.org\/latest.zip<\/p>\n<p>[root@web01 ~]$ unzip latest.zip<\/p>\n<h4>\u4fee\u6539\u7528\u6237<\/h4>\n<p>[root@web01 ~]$ chown -R nginx.nginx \/code\/wordpress\/<\/p>\n<h4>\u5199\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>[root@web01 ~]$ cat \/etc\/nginx\/conf.d\/blog.wordpress.com.conf<br \/>\nserver {<br \/>\nlisten 80;<br \/>\nserver_name blog.wordpress.com;<br \/>\nroot \/code\/wordpress;<br \/>\nlocation \/ {<br \/>\nindex index.html index.php;<br \/>\n}<\/p>\n<p>location ~ \\.php {<br \/>\nfastcgi_pass 127.0.0.1:9000;<br \/>\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br \/>\ninclude fastcgi_params;<br \/>\n}<br \/>\n}<\/p>\n<h4>\u68c0\u67e5\u8bed\u6cd5<\/h4>\n<p>[root@web01 ~]$ nginx -t<br \/>\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok<br \/>\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/p>\n<h4>\u91cd\u542fnginx<\/h4>\n<p>[root@web01 ~]$ systemctl reload nginx.service<\/p>\n<h4>\u521b\u5efa\u6570\u636e\u5e93<\/h4>\n<p>[root@web01 ~]$ mysql -uroot -p123<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 7<br \/>\nServer version: 5.5.68-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt; show databases;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| Database |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| information_schema |<br \/>\n| mysql |<br \/>\n| performance_schema |<br \/>\n| test |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n4 rows in set (0.10 sec)<\/p>\n<p>MariaDB [(none)]&gt; create database wordpress;<br \/>\nQuery OK, 1 row affected (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt; show databases;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| Database |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| information_schema |<br \/>\n| mysql |<br \/>\n| performance_schema |<br \/>\n| test |<br \/>\n| wordpress |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n5 rows in set (0.00 sec)<\/p>\n<h4>\u5220\u9664<\/h4>\n<p>drop\u00a0 database wordpress;<\/p>\n<h4>web\u9875\u9762\u5b89\u88c5\u4ea7\u54c1<\/h4>\n<p><a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=868\" rel=\"attachment wp-att-868\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-868\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress1.png?resize=640%2C458&#038;ssl=1\" alt=\"\" width=\"640\" height=\"458\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress1.png?w=1251&amp;ssl=1 1251w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress1.png?resize=300%2C215&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress1.png?resize=1024%2C733&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress1.png?resize=768%2C549&amp;ssl=1 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a> <a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=869\" rel=\"attachment wp-att-869\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-869\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress2.png?resize=640%2C372&#038;ssl=1\" alt=\"\" width=\"640\" height=\"372\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress2.png?w=1350&amp;ssl=1 1350w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress2.png?resize=300%2C174&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress2.png?resize=1024%2C595&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress2.png?resize=768%2C447&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress2.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a> <a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=870\" rel=\"attachment wp-att-870\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-870\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress3.png?resize=640%2C411&#038;ssl=1\" alt=\"\" width=\"640\" height=\"411\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress3.png?w=1288&amp;ssl=1 1288w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress3.png?resize=300%2C193&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress3.png?resize=1024%2C658&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress3.png?resize=768%2C494&amp;ssl=1 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a> <a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=871\" rel=\"attachment wp-att-871\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-871\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress4.png?resize=640%2C414&#038;ssl=1\" alt=\"\" width=\"640\" height=\"414\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress4.png?w=1327&amp;ssl=1 1327w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress4.png?resize=300%2C194&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress4.png?resize=1024%2C663&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress4.png?resize=768%2C497&amp;ssl=1 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a> <a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=872\" rel=\"attachment wp-att-872\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-872\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress5.png?resize=640%2C365&#038;ssl=1\" alt=\"\" width=\"640\" height=\"365\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress5.png?w=1497&amp;ssl=1 1497w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress5.png?resize=300%2C171&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress5.png?resize=1024%2C584&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress5.png?resize=768%2C438&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress5.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a> <a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=873\" rel=\"attachment wp-att-873\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-873\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress6.png?resize=640%2C324&#038;ssl=1\" alt=\"\" width=\"640\" height=\"324\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress6.png?w=1665&amp;ssl=1 1665w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress6.png?resize=300%2C152&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress6.png?resize=1024%2C518&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress6.png?resize=768%2C389&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress6.png?resize=1536%2C778&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wordpress6.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h4>\u67e5\u770b\u6570\u636e\u5e93<\/h4>\n<p>[root@web01 ~]$ mysql -uroot -p123<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 23<br \/>\nServer version: 5.5.68-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt; show tables from wordpress;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| Tables_in_wordpress |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| wp_commentmeta |<br \/>\n| wp_comments |<br \/>\n| wp_links |<br \/>\n| wp_options |<br \/>\n| wp_postmeta |<br \/>\n| wp_posts |<br \/>\n| wp_term_relationships |<br \/>\n| wp_term_taxonomy |<br \/>\n| wp_termmeta |<br \/>\n| wp_terms |<br \/>\n| wp_usermeta |<br \/>\n| wp_users |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n12 rows in set (0.00 sec)<\/p>\n<h1>10.\u5b89\u88c5wecenter<\/h1>\n<h2><a href=\"https:\/\/wenda.wecenter.com\/\">\u5b98\u7f51<\/a><\/h2>\n<h4>\u4e0b\u8f7d<\/h4>\n<p>[root@web01 ~]$ mkdir \/code\/wecenter<br \/>\n[root@web01 ~]$ mv WeCenter_V4.0.2.zip \/code\/wecenter\/<br \/>\n[root@web01 ~]$ cd \/code\/wecenter\/<br \/>\n[root@web01 \/code\/wecenter]$ unzip WeCenter_V4.0.2.zip<br \/>\n[root@web01 \/code\/wecenter]$ rm -rf WeCenter_V4.0.2.zip<\/p>\n<h4>\u4fee\u6539\u6743\u9650<\/h4>\n<p>[root@web01 \/code\/wecenter]$ find -type f -print0 | xargs -0 chmod 644<br \/>\n[root@web01 \/code\/wecenter]$ find -type d -print0 | xargs -0 chmod 755<br \/>\n[root@web01 \/code\/wecenter]$ chown -R nginx.nginx \/code\/wecenter\/<\/p>\n<h4>\u5199\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>[root@web01 \/code\/wecenter]$ cat \/etc\/nginx\/conf.d\/blog.wecenter.com.conf<br \/>\nserver {<br \/>\nlisten 80;<br \/>\nserver_name blog.wecenter.com;<br \/>\nroot \/code\/wecenter;<br \/>\nlocation \/ {<br \/>\nindex index.html index.php;<br \/>\n}<\/p>\n<p>location ~ \\.php {<br \/>\nfastcgi_pass 127.0.0.1:9000;<br \/>\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br \/>\ninclude fastcgi_params;<br \/>\n}<br \/>\n}<\/p>\n<h4>\u68c0\u67e5\u8bed\u6cd5<\/h4>\n<p>[root@web01 ~]$ nginx -t<br \/>\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok<br \/>\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/p>\n<h4>\u91cd\u542fnginx<\/h4>\n<p>[root@web01 ~]$ systemctl reload nginx.service<\/p>\n<h4>\u521b\u5efa\u6570\u636e\u5e93<\/h4>\n<p>[root@web01 \/code\/wecenter]$ mysql -uroot -p123<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 387<br \/>\nServer version: 5.5.68-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt; create database wecenter;<br \/>\nQuery OK, 1 row affected (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt; show databases;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| Database |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n| information_schema |<br \/>\n| mysql |<br \/>\n| performance_schema |<br \/>\n| test |<br \/>\n| wecenter |<br \/>\n| wordpress |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\n6 rows in set (0.00 sec)<\/p>\n<h4>\u8bf4\u660e\u6587\u6863<\/h4>\n<p>[root@web01 ~]$ cat \/code\/wecenter\/README.md<\/p>\n<h4>\u6d4b\u8bd5<\/h4>\n<p><a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=875\" rel=\"attachment wp-att-875\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-875\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter1.png?resize=640%2C341&#038;ssl=1\" alt=\"\" width=\"640\" height=\"341\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter1.png?w=1534&amp;ssl=1 1534w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter1.png?resize=300%2C160&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter1.png?resize=1024%2C546&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter1.png?resize=768%2C410&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter1.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a> <a href=\"https:\/\/www.qiangzhenshuai.com\/?attachment_id=876\" rel=\"attachment wp-att-876\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-876\" src=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter2.png?resize=640%2C357&#038;ssl=1\" alt=\"\" width=\"640\" height=\"357\" srcset=\"https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter2.png?w=1726&amp;ssl=1 1726w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter2.png?resize=300%2C167&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter2.png?resize=1024%2C571&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter2.png?resize=768%2C428&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter2.png?resize=1536%2C856&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.qiangzhenshuai.com\/wp-content\/uploads\/2022\/08\/\u5b89\u88c5wecenter2.png?w=1280&amp;ssl=1 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h1>11.LNMP\u67b6\u6784\u6f14\u53d8<\/h1>\n<h2>\u7f51\u7ad9\u8fc1\u79fb<\/h2>\n<h4>\u51c6\u5907\u73af\u5883<\/h4>\n<p>web\u670d\u52a1\u5668<\/p>\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668<\/p>\n<p>\u5b58\u50a8\u670d\u52a1\u5668<\/p>\n<h2>\u8fc1\u79fb\u8fc7\u7a0b<\/h2>\n<p>\u68c0\u67e5web\u662f\u5426\u6b63\u5e38<br \/>\n\u8fc1\u79fbweb\u670d\u52a1\u5668\u7684\u6570\u636e(\u7528\u6237\u4e0a\u4f20 web\u5230\u5b58\u50a8\u670d\u52a1\u5668(nfs<br \/>\n\u8fc1\u79fbweb\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\u5185\u5bb9(web)\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668(db)<br \/>\n\u6269\u5bb9web\u670d\u52a1\u5668\/\u6a2a\u5411\u6269\u5c55web\u670d\u52a1\u5668<\/p>\n<h4>\u9759\u6001\u8d44\u6e90\u8fc1\u79fb\uff08\u5171\u4eab\u5b58\u50a8nfs\uff09<\/h4>\n<p>\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u5728\u54ea\u91cc<br \/>\n\u5148\u628aweb\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u7684\u5185\u5bb9\u590d\u5236\u51fa\u6765<br \/>\n\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u6302\u8f7d\u5230nfs\u4e0a\u9762<br \/>\n\u68c0\u67e5nfs\u662f\u5426\u53ef\u4ee5<br \/>\n\u914d\u7f6enfs\u5171\u4eab\u76ee\u5f55<br \/>\nnfs\u6302\u8f7d\u5230web\u670d\u52a1\u5668<br \/>\n\u628a\u590d\u5236\u8d70\u7684,\u590d\u5236\u5230\u539f\u6765\u7684\u5730\u65b9(\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u4e2d)<br \/>\nweb\u670d\u52a1\u5668\u68c0\u67e5\u7528\u6237\u4e0a\u4f20\u6587\u4ef6\u662f\u5426\u53ef\u7528<br \/>\n\u68c0\u67e5\u670d\u52a1\u662f\u5426\u5f00\u673a\u81ea\u542f\u52a8<\/p>\n<h4>\u5148\u628aweb\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u7684\u5185\u5bb9\u590d\u5236\u51fa\u6765\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u5728\u54ea\u91cc<\/h4>\n<p>[root@web01 ~]$ ll \/code\/wordpress\/wp-content\/uploads\/<\/p>\n<h4>\u5148\u628aweb\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u7684\u5185\u5bb9\u590d\u5236\u51fa\u6765(\u6302\u8f7dnfs\u8986\u76d6)<\/h4>\n<p>[root@web01 ~]$ mkdir -p \/backer\/<br \/>\n[root@web01 ~]$ mv \/code\/wordpress\/wp-content\/uploads\/* \/backer\/<\/p>\n<h3>nfs\u670d\u52a1\u5668<\/h3>\n<h4>\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>[root@nfs ~]$ cat \/etc\/exports<br \/>\n\/dmxsp\/wordpress 172.16.1.0\/24(rw,all_squash)<\/p>\n<p>[root@nfs ~]$ mkdir -p \/dmxsp\/wordpress<\/p>\n<h4>\u4fee\u6539\u4e3b<\/h4>\n<p>[root@nfs ~]$ chown nfsnobody.nfsnobody \/dmxsp\/wordpress\/<\/p>\n<h3>\u5ba2\u6237\u7aefweb\u670d\u52a1\u5668\u8fdb\u884c\u6302\u8f7d<\/h3>\n<h4>\u5b89\u88c5<\/h4>\n<p>[root@web01 ~]$ yum install -y nfs-utils rpcbind<\/p>\n<p>[root@web01 ~]$ systemctl start rpcbind.service nfs<br \/>\n[root@web01 ~]$ systemctl enable rpcbind.service nfs<\/p>\n<h4>\u6302\u8f7d<\/h4>\n<p>[root@web01 ~]$ mount -t nfs 172.16.1.16:\/dmxsp\/wordpress\/ \/code\/wordpress\/wp-content\/uploads\/<\/p>\n<p>[root@web01 ~]$ df -h<br \/>\nFilesystem Size Used Avail Use% Mounted on<br \/>\ndevtmpfs 898M 0 898M 0% \/dev<br \/>\ntmpfs 910M 0 910M 0% \/dev\/shm<br \/>\ntmpfs 910M 9.6M 901M 2% \/run<br \/>\ntmpfs 910M 0 910M 0% \/sys\/fs\/cgroup<br \/>\n\/dev\/mapper\/centos-root 47G 5.2G 42G 12% \/<br \/>\n\/dev\/sda1 1014M 151M 864M 15% \/boot<br \/>\ntmpfs 182M 0 182M 0% \/run\/user\/0<br \/>\n172.16.1.16:\/dmxsp\/wordpress 47G 2.0G 46G 5% \/code\/wordpress\/wp-content\/uploads<\/p>\n<h4>\u628a\u590d\u5236\u8d70\u7684,\u590d\u5236\u5230\u539f\u6765\u7684\u5730\u65b9(\u7528\u6237\u4e0a\u4f20\u76ee\u5f55\u4e2d)<\/h4>\n<p>[root@web01 ~]$ mv \/backer\/* \/code\/wordpress\/wp-content\/uploads<br \/>\nmv: failed to preserve ownership for \u2018\/code\/wordpress\/wp-content\/uploads\/2022\/08\/\u7f51\u7ebf.png\u2019: Operation not permitted<br \/>\nmv: failed to preserve ownership for \u2018\/code\/wordpress\/wp-content\/uploads\/2022\/08\/\u7f51\u7ebf-300&#215;143.png\u2019: Operation not permitted<br \/>\nmv: failed to preserve ownership for \u2018\/code\/wordpress\/wp-content\/uploads\/2022\/08\/\u7f51\u7ebf-150&#215;150.png\u2019: Operation not permitted<br \/>\nmv: failed to preserve ownership for \u2018\/code\/wordpress\/wp-content\/uploads\/2022\/08\/\u7f51\u7ebf-768&#215;365.png\u2019: Operation not permitted<br \/>\nmv: failed to preserve ownership for \u2018\/code\/wordpress\/wp-content\/uploads\/2022\/08\u2019: Operation not permitted<br \/>\nmv: failed to preserve ownership for \u2018\/code\/wordpress\/wp-content\/uploads\/2022\u2019: Operation not permitted<\/p>\n<h4>\u4e0a\u4f20\u7167\u7247\u67e5\u770bnfs\u670d\u52a1\u5668\u662f\u5426\u6b63\u5e38<\/h4>\n<h2>\u8fc1\u79fb\u6570\u636e\u5e93\u81f3\u6570\u636e\u5e93\u670d\u52a1\u5668<\/h2>\n<p>\u8fc1\u79fb\u6570\u636e\u5e93<br \/>\n\u5728mysqldb\u51c6\u5907\u6570\u636e\u5e93\u73af\u5883<br \/>\n\u5728web\u670d\u52a1\u5668\u5907\u4efd\u6570\u636e\u5e93\u5185\u5bb9<br \/>\n\u5907\u4efd\u4f20\u9001\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668<br \/>\n\u628a\u5907\u4efd\u5bfc\u5165\u5230\u65b0\u7684\u6570\u636e\u5e93\u4e2d<br \/>\nweb\u670d\u52a1\u5668<br \/>\n\u4fee\u6539\u7a0b\u5e8f\u4ee3\u7801,\u8bbf\u95eemysqldb\u7684\u6570\u636e\u5e93<\/p>\n<h4>mysqldb\u51c6\u5907\u6570\u636e\u5e93\u73af\u5883<\/h4>\n<p>[root@mysqldb ~]$ yum install -y mariadb-server<\/p>\n<p>[root@mysqldb ~]$ systemctl start mariadb.service<br \/>\n[root@mysqldb ~]$ systemctl enable mariadb.service<\/p>\n<h4>web\u670d\u52a1\u5668\u5907\u4efd\u6570\u636e\u5e93<\/h4>\n<p>[root@web01 ~]$ mysqldump -uroot -p123<br \/>\nUsage: mysqldump [OPTIONS] database [tables]<br \/>\nOR mysqldump [OPTIONS] &#8211;databases [OPTIONS] DB1 [DB2 DB3&#8230;]<br \/>\nOR mysqldump [OPTIONS] &#8211;all-databases [OPTIONS]<br \/>\nFor more options, use mysqldump &#8211;help<\/p>\n<h4>\u4ec5\u5bfc\u51fa<\/h4>\n<p>[root@web01 ~]$ mysqldump -uroot -p123 -A &gt;all.sql<\/p>\n<h4>\u5bfc\u51fa\u5e76\u538b\u7f29<\/h4>\n<p>[root@web01 ~]$mysqldump -uroot -p123 -A |gzip &gt;all.sql.gz<\/p>\n<h4>\u5907\u4efd\u4f20\u9001\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668<\/h4>\n<p>[root@web01 ~]$ scp all.sql 172.16.1.26:\/root<\/p>\n<h4>\u5bfc\u5165\u5230\u65b0\u7684\u6570\u636e\u5e93\u4e2d<\/h4>\n<p>[root@mysqldb ~]$ mysql &lt;all.sql<\/p>\n<h4>\u5237\u65b0mysql\u6743\u9650\u4fe1\u606f\uff08\u5982\u679c\u4e0d\u5237\u65b0\uff0c\u767b\u5f55\u65f6\u8981\u548c\u5bfc\u5165\u6570\u636e\u7684\u7528\u6237\u5bc6\u7801\u76f8\u540c\u767b\u5f55\u4e0d\u4e0a\u53bb\uff09<\/h4>\n<p>[root@mysqldb ~]$ mysql<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 5<br \/>\nServer version: 5.5.68-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt; flush privileges;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<\/p>\n<p>[root@mysqldb ~]$ mysql -uroot -p123<\/p>\n<h4>\u6388\u6743\u8fdc\u7a0b\u767b\u5f55<\/h4>\n<p>MariaDB [(none)]&gt; select user,host from mysql.user;<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n| user | host |<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n| root | 127.0.0.1 |<br \/>\n| root | ::1 |<br \/>\n| | localhost |<br \/>\n| root | localhost |<br \/>\n| | web01 |<br \/>\n| root | web01 |<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n6 rows in set (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt; grant all on *.* to &#8216;all&#8217;@&#8217;%&#8217; identified by &#8216;123&#8217;;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt; select user,host from mysql.user;<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n| user | host |<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n| all | % |<br \/>\n| root | 127.0.0.1 |<br \/>\n| root | ::1 |<br \/>\n| root | localhost |<br \/>\n| root | web01 |<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<\/p>\n<h4>\u5220\u9664\u6ca1\u6709\u7528\u6237\u7684\u591a\u4f59\u4e3b\u673a<\/h4>\n<p>MariaDB [(none)]&gt; drop user &#8221;@&#8217;localhost&#8217;;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt; drop user &#8221;@&#8217;web01&#8242;;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<\/p>\n<p>MariaDB [(none)]&gt; select user,host from mysql.user;<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n| user | host |<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n| root | % |<br \/>\n| root | 127.0.0.1 |<br \/>\n| root | ::1 |<br \/>\n| root | localhost |<br \/>\n| root | web01 |<br \/>\n+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+<br \/>\n5 rows in set (0.00 sec)<\/p>\n<h4>\u5237\u65b0\u6743\u9650<\/h4>\n<p>MariaDB [(none)]&gt; flush privileges;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<\/p>\n<h4>web\u8fde\u63a5\u8fdc\u7a0bmysql<\/h4>\n<p>[root@web01 ~]$ mysql -uroot -p123 -h 172.16.1.26<br \/>\nWelcome to the MariaDB monitor. Commands end with ; or \\g.<br \/>\nYour MariaDB connection id is 7<br \/>\nServer version: 5.5.68-MariaDB MariaDB Server<\/p>\n<p>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<\/p>\n<p>Type &#8216;help;&#8217; or &#8216;\\h&#8217; for help. Type &#8216;\\c&#8217; to clear the current input statement.<\/p>\n<p>MariaDB [(none)]&gt;<\/p>\n<h4>\u4fee\u6539\u7a0b\u5e8f\u4ee3\u7801,\u8bbf\u95eemysqldb\u7684\u6570\u636e\u5e93<\/h4>\n<p>[root@web01 ~]$ grep DB_ \/code\/wordpress\/wp-config.php<br \/>\ndefine( &#8216;DB_NAME&#8217;, &#8216;wordpress&#8217; );<br \/>\ndefine( &#8216;DB_USER&#8217;, &#8216;all&#8217; );<br \/>\ndefine( &#8216;DB_PASSWORD&#8217;, &#8216;123&#8217; );<br \/>\ndefine( &#8216;DB_HOST&#8217;, &#8216;172.16.1.26&#8217; );<br \/>\ndefine( &#8216;DB_CHARSET&#8217;, &#8216;utf8mb4&#8217; );<br \/>\ndefine( &#8216;DB_COLLATE&#8217;, &#8221; );<\/p>\n<h4>\u6d4b\u8bd5<\/h4>\n<p>[root@web01 ~]$ systemctl stop mariadb.service<\/p>\n<p>[root@web01 ~]$ ss -lntup | grep mysql<\/p>\n<p><strong>(\u76ee\u5f55\u6240\u6709\u8005\u4e0d\u9700\u8981\u5168\u90e8\u4fee\u6539\uff0c\u53ea\u9700\u8981\u4fee\u6539\u7528\u5230\u7684\u76ee\u5f55\u5982\uff1a\u56fe\u7247\u76ee\u5f55\u7b49\u7b49)<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u4ec0\u4e48\u662fLNMP LNMP \u662f\u4e00\u5957\u6280\u672f\u7684\u7ec4\u5408\uff0c L=Linux\u3001 N=Nginx\u3001 M=MySQL\u3001 P=P [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[19],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=\/wp\/v2\/posts\/854"}],"collection":[{"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=854"}],"version-history":[{"count":15,"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=\/wp\/v2\/posts\/854\/revisions"}],"predecessor-version":[{"id":948,"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=\/wp\/v2\/posts\/854\/revisions\/948"}],"wp:attachment":[{"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qiangzhenshuai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}