{"id":458,"date":"2020-12-19T11:29:47","date_gmt":"2020-12-19T03:29:47","guid":{"rendered":"https:\/\/www.wangliguang.cn\/?p=458"},"modified":"2020-12-19T11:29:47","modified_gmt":"2020-12-19T03:29:47","slug":"centos7-6%e6%90%ad%e5%bb%balnmp%e7%8e%af%e5%a2%83-centos7-6%e5%ae%89%e8%a3%85nginx-centos7-6%e5%ae%89%e8%a3%85php-centos7-6%e5%ae%89%e8%a3%85mysql-%e8%af%a6%e7%bb%86%e5%ae%8c%e6%95%b4%e6%95%99","status":"publish","type":"post","link":"https:\/\/wangliguang.cn\/?p=458","title":{"rendered":"CentOS7.6\u642d\u5efaLNMP\u73af\u5883"},"content":{"rendered":"<h2>\u80cc\u666f<\/h2>\n<p>\u5728\u5b89\u88c5typecho\u3001wordpress\u4e4b\u524d\uff0c\u5f80\u5f80\u9700\u8981\u5b89\u88c5nginx\u3001mysql\u3001php\u7b49\u73af\u5883\u3002\u672c\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u5982\u4f55\u5728centos7.6\u4e0a\u642d\u5efaLNMP\u73af\u5883\u3002\u672c\u6587\u4e3b\u8981\u53c2\u8003\u4e86\u817e\u8baf\u4e91\u63d0\u4f9b\u7684\u4e00\u4e9b\u5e2e\u52a9\u6587\u6863\uff0c\u5e76\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u505a\u4e86\u6539\u8fdb\uff0c\u540c\u65f6\u5c06\u90e8\u5206\u955c\u50cf\u4f18\u5316\u4e3a\u6e05\u534e\u3001\u5317\u4eac\u5916\u56fd\u8bed\u7b49\u56fd\u5185\u955c\u50cf\uff0c\u53ef\u4ee5\u52a0\u901f\u5b89\u88c5\u548c\u63d0\u9ad8\u6210\u529f\u7387\uff01<br \/>\n\u672c\u6587\u9996\u53d1\u4e8e<a href=\"https:\/\/liguang.wang\">\u6211\u7684\u5b66\u4e60\u4e4b\u8def\uff08liguang.wang)<\/a>\uff0c\u6b22\u8fce\u8bbf\u95ee\uff01<\/p>\n<h2>\u4e00\u3001\u5b89\u88c5nginx<\/h2>\n<p>1\u3001\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5728\u521b\u5efa nginx.repo \u6587\u4ef6\u3002<\/p>\n<pre><code>vi \/etc\/yum.repos.d\/nginx.repo<\/code><\/pre>\n<p>2\u3001\u6572\u51fb<code>i<\/code>\u8fdb\u5165\u7f16\u8f91\u6a21\u5f0f\uff0c\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\u3002<\/p>\n<pre><code>[nginx]\nname = nginx repo\nbaseurl = https:\/\/nginx.org\/packages\/mainline\/centos\/7\/$basearch\/\ngpgcheck = 0\nenabled = 1<\/code><\/pre>\n<p>\u6309<code>:wq<\/code>\u4fdd\u5b58\u5e76\u9000\u51fa\u3002<br \/>\n3\u3001\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5nginx\u3002<\/p>\n<pre><code>yum install -y nginx<\/code><\/pre>\n<p>4\u3001\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u8fdb\u5165<code>conf.d<\/code>\u6587\u4ef6\u5939\u3002<\/p>\n<pre><code>cd \/etc\/nginx\/conf.d<\/code><\/pre>\n<p>5\u3001\u5907\u4efd\u9ed8\u8ba4\u6587\u4ef6\u3002<\/p>\n<pre><code>cp default.conf default.conf.bak<\/code><\/pre>\n<p>6\u3001\u65b0\u5efa\u5e76\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre><code>vim mysite.conf<\/code><\/pre>\n<p>7\u3001\u6309\u4e0b<code>i<\/code>\u952e\uff0c\u7136\u540e\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9\u3002\u7136\u540e<code>:wq<\/code>\u4fdd\u5b58\u63a8\u51fa\u3002<\/p>\n<pre><code>server {\n listen       80;\n root   \/usr\/share\/nginx\/html;\n server_name  localhost;\n #charset koi8-r;\n #access_log  \/var\/log\/nginx\/log\/host.access.log  main;\n #\n location \/ {\n       index index.php index.html index.htm;\n }\n #error_page  404              \/404.html;\n #redirect server error pages to the static page \/50x.html\n #\n error_page   500 502 503 504  \/50x.html;\n location = \/50x.html {\n   root   \/usr\/share\/nginx\/html;\n }\n #pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n #\n location ~ .php$ {\n   fastcgi_pass   127.0.0.1:9000;\n   fastcgi_index  index.php;\n   fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;\n   include        fastcgi_params;\n }\n}<\/code><\/pre>\n<p>8\u3001\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8nginx\u5e76\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u3002<\/p>\n<pre><code>systemctl start nginx\nsystemctl enable nginx<\/code><\/pre>\n<p>9\u3001\u8bbf\u95ee\u670d\u52a1\u5668IP\u770b\u662f\u5426\u6210\u529f\u8fd0\u884c<\/p>\n<pre><code>http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP<\/code><\/pre>\n<p>\u5982\u679c\u73b0\u5b9e\u7c7b\u4f3c\u4e0b\u56fe\u7684\u754c\u9762\uff0c\u8868\u793anginx\u5b89\u88c5\u6210\u529f\uff0c\u8bf7\u7ee7\u7eed\u8fdb\u884c\u7b2c\u4e8c\u90e8\u5206\u7684\u5b89\u88c5\uff01<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wangliguang.cn\/wp-content\/uploads\/2020\/11\/fdc40877928729679d392eb304a3f12c.png\" alt=\"nginx\" \/><\/p>\n<h2>\u4e8c\u3001\u5b89\u88c5MariaDB<\/h2>\n<p>\u7531\u4e8eMariaDB\u662f\u517c\u5bb9mysql\u7684\uff0c\u6211\u4eec\u6b64\u5904\u9009\u62e9\u5b89\u88c5MariaDB\u3002<br \/>\n1\u3001\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u67e5\u770b\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u8fc7MariaDB\u3002<\/p>\n<pre><code>rpm -qa | grep -i mariadb<\/code><\/pre>\n<p>2\u3001\u5982\u679c\u5b58\u5728\u7c7b\u4f3c\u56fe\u7247\u6240\u793a\u7684\u60c5\u51b5\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u79fb\u9664\u3002<strong>\u5982\u679c\u6ca1\u6709\u4efb\u4f55\u663e\u793a\u5219\u8df3\u8fc7\u8fd9\u4e00\u6b65\u3002<\/strong><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wangliguang.cn\/wp-content\/uploads\/2020\/11\/6fa7fb51de4a61f4da08eb036b6c3e85.png\" alt=\"\u7ed3\u679c\u56fe\u7247\" \/><\/p>\n<pre><code>yum -y remove \u5305\u540d\uff08\u53ef\u76f4\u63a5\u590d\u5236\u7c98\u8d34\u4e0a\u4e00\u6b65\u7684\u7ed3\u679c\uff09<\/code><\/pre>\n<p>3\u3001\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u521b\u5efaMariaDB.repo\u6587\u4ef6\u3002<\/p>\n<pre><code>vi \/etc\/yum.repos.d\/MariaDB.repo<\/code><\/pre>\n<p>4\u3001\u6309\u4e0b<code>i<\/code>\uff0c\u5199\u5165\u5982\u4e0b\u5185\u5bb9\u3002<strong>\u672c\u6587\u91c7\u7528\u5317\u4eac\u5916\u56fd\u8bed\u955c\u50cf\u52a0\u901f\u5b89\u88c5\u901f\u5ea6\uff01<\/strong><\/p>\n<pre><code># MariaDB 10.4 CentOS repository list - created 2019-11-05 11:56 UTC\n# http:\/\/downloads.mariadb.org\/mariadb\/repositories\/\n[mariadb]\nname = MariaDB\nbaseurl = https:\/\/mirrors.bfsu.edu.cn\/mariadb\/yum\/10.4\/centos7-amd64\ngpgkey=https:\/\/mirrors.bfsu.edu.cn\/mariadb\/yum\/RPM-GPG-KEY-MariaDB\ngpgcheck=1<\/code><\/pre>\n<p>5\u3001\u8f93\u5165<code>:wq<\/code>\u4fdd\u5b58\u5e76\u63a8\u51fa\u3002<br \/>\n6\u3001\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u5f00\u59cb\u5b89\u88c5MariaDB\u3002<\/p>\n<pre><code>yum -y install MariaDB-client MariaDB-server<\/code><\/pre>\n<p>7\u3001\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u542f\u52a8MariaDB\u5e76\u8bbe\u7f6e\u5f00\u673a\u81ea\u52a8\u542f\u52a8\u3002<\/p>\n<pre><code>systemctl start mariadb\nsystemctl enable mariadb<\/code><\/pre>\n<p>8\u3001\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff0c\u5982\u679c\u51fa\u73b0\u56fe\u7247\u6240\u793a\u7684\u60c5\u51b5\uff0c\u8868\u793a\u5b89\u88c5\u6210\u529f\uff0c\u6309\u4e0b<code>\\q<\/code>\u9000\u51fa\u3002<\/p>\n<pre><code>mysql<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.wangliguang.cn\/wp-content\/uploads\/2020\/11\/6fa7fb51de4a61f4da08eb036b6c3e85-1.png\" alt=\"\u5b89\u88c5\u6210\u529f\u540e\u7684\u6548\u679c\" \/><\/p>\n<h2>\u4e09\u3001\u5b89\u88c5PHP<\/h2>\n<p>1\u3001\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u66f4\u65b0yum\u4e2d\u7684\u8f6f\u4ef6\u6e90\u3002<\/p>\n<pre><code>rpm -Uvh https:\/\/mirrors.cloud.tencent.com\/epel\/epel-release-latest-7.noarch.rpm\nrpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm<\/code><\/pre>\n<p>2\u3001\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u5b89\u88c5\u6240\u9700\u7684\u5305\u3002<\/p>\n<pre><code>yum -y install mod_php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-mysqlnd php72w-fpm.x86_64<\/code><\/pre>\n<p>3\u3001\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u542f\u52a8php-fpm\u548c\u8bbe\u7f6e\u5f00\u673a\u81ea\u52a8\u542f\u52a8\u3002<\/p>\n<pre><code>systemctl start php-fpm\nsystemctl enable php-fpm<\/code><\/pre>\n<p>4\u3001\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u6d4b\u8bd5\u6587\u4ef6\u3002<\/p>\n<pre><code>echo &amp;quot;&amp;lt;?php phpinfo(); ?&amp;gt;&amp;quot; &amp;gt;&amp;gt; \/usr\/share\/nginx\/html\/index.php<\/code><\/pre>\n<p>5\u3001\u91cd\u542fnginx\u3002<\/p>\n<pre><code>systemctl restart nginx<\/code><\/pre>\n<p>6\u3001\u8bbf\u95ee\u670d\u52a1\u5668\uff0c\u5982\u679c\u51fa\u73b0\u5982\u4e0b\u754c\u9762\u8868\u793a\u5b89\u88c5\u5b8c\u6210\uff01<\/p>\n<pre><code>http:\/\/\u4f60\u7684\u670d\u52a1\u5668IP<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.wangliguang.cn\/wp-content\/uploads\/2020\/11\/640812413941a61efe29d7faa546ad80.png\" alt=\"php\u5b89\u88c5\u6210\u529f\" \/><\/p>\n<h2>\u56db\u3001\u652f\u6301\u4f5c\u8005\u548c\u7591\u95ee\u89e3\u7b54<\/h2>\n<p>\u5199\u6587\u7ae0\u4e0d\u6613\uff0c\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u6709\u5e2e\u5230\u4f60\uff0c\u5e0c\u671b\u4f60\u80fd\u7ed9\u4e88\u4e00\u5b9a\u8d5e\u8d4f\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5f53\u524d\u7f51\u7ad9\u6216App\u7684\u8d5e\u8d4f\u6e20\u9053\u652f\u6301\uff0c\u6216\u8005<a href=\"https:\/\/www.wangliguang.cn\/?page_id=25\" title=\"\u70b9\u51fb\u6b64\u5904\u652f\u6301\u4f5c\u8005\">\u70b9\u51fb\u6b64\u5904\u652f\u6301\u4f5c\u8005<\/a>\uff01<br \/>\n\u5982\u679c\u5bf9\u4e8e\u672c\u6587\u5185\u5bb9\u6709\u7591\u95ee\uff0c\u53ef\u4ee5<a href=\"https:\/\/liguang.wang\/index.php\/about-author.html\" title=\"\u70b9\u51fb\u6b64\u5904\u8054\u7cfb\u4f5c\u8005\">\u70b9\u51fb\u6b64\u5904\u8054\u7cfb\u4f5c\u8005<\/a>\uff01<\/p>\n<h2>\u4e94\u3001\u53c2\u8003\u8d44\u6599<\/h2>\n<p>\u90e8\u5206\u56fe\u7247\u548c\u6587\u5b57\u6765\u6e90\u4e8e\u5982\u4e0b\u94fe\u63a5\uff0c\u5728\u6b64\u8868\u793a\u611f\u8c22\uff01<br \/>\n<a href=\"https:\/\/cloud.tencent.com\/document\/product\/213\/38838\">https:\/\/cloud.tencent.com\/document\/product\/213\/38838<\/a><br \/>\n<a href=\"https:\/\/cloud.tencent.com\/document\/product\/213\/38056\">https:\/\/cloud.tencent.com\/document\/product\/213\/38056<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u5728\u5b89\u88c5typecho\u3001wordpress\u4e4b\u524d\uff0c\u5f80\u5f80\u9700\u8981\u5b89\u88c5nginx\u3001mysql\u3001php\u7b49\u73af\u5883\u3002\u672c\u6587\u7ae0\u4e3b&hellip; <a href=\"https:\/\/wangliguang.cn\/?p=458\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">CentOS7.6\u642d\u5efaLNMP\u73af\u5883<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,24],"tags":[],"class_list":["post-458","post","type-post","status-publish","format-standard","hentry","category-14","category-24"],"_links":{"self":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts\/458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=458"}],"version-history":[{"count":0,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts\/458\/revisions"}],"wp:attachment":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}