{"id":76,"date":"2022-05-01T00:24:50","date_gmt":"2022-04-30T16:24:50","guid":{"rendered":"https:\/\/frogvps.com\/?p=76"},"modified":"2022-05-18T12:36:54","modified_gmt":"2022-05-18T04:36:54","slug":"lnmp%e6%9e%b6%e6%9e%84%e6%90%ad%e5%bb%bawordpress","status":"publish","type":"post","link":"https:\/\/frogvps.com\/?p=76","title":{"rendered":"LNMP\u67b6\u6784\u642d\u5efawordpress"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"615\" src=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a1-1024x615.jpg\" alt=\"\" class=\"wp-image-193\" srcset=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a1-1024x615.jpg 1024w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a1-300x180.jpg 300w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a1-768x461.jpg 768w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a1.jpg 1069w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">LNMP\u67b6\u6784\u4ecb\u7ecd<\/h2>\n\n\n\n<p>LNMP\u67b6\u6784\uff0c\u7b80\u5355\u5730\u6765\u8bf4\u5c31\u662flinux \u7cfb\u7edf + Nginx web\u670d\u52a1\u5668 + MYSQL \u6570\u636e\u5e93 +PHP \u670d\u52a1\u3002\u672c\u7ad9\u4f7f\u7528\u7684\u5c31\u662f\u8fd9\u4e2a\u67b6\u6784\uff0c\u642d\u5efa\u5b8cLNMP\u6211\u4eec\u5c31\u53ef\u4ee5\u7528wordpress\u6765\u5efa\u7acb\u81ea\u5df1\u7684\u7f51\u7ad9\u4e86\uff0cLNMP\u600e\u4e48\u642d\u5efa\uff1f\u4e0b\u9762\u5c06\u4ecb\u7ecd\u624b\u52a8\u90e8\u7f72LNMP\u67b6\u6784\u7684\u65b9\u6cd5\u3002\u9002\u7528\u4e8eUbuntu\u548cDebian\u7cfb\u7edf\u3002Centos7\u628aapt\u547d\u4ee4\u6362\u6210yum\u5c31\u53ef\u4ee5\u4e86\uff0c\u914d\u7f6e\u65b9\u6cd5\u90fd\u662f\u4e00\u6837\u7684\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b89\u88c5nginx<\/h2>\n\n\n\n<p>ubuntu\u5148\u66f4\u65b0\u4e0b\u8f6f\u4ef6\u5305<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<p><strong>\u521b\u5efa\u7528\u6237<\/strong><\/p>\n\n\n\n<p>Debain\u7cfb\u7edf\u4e0d\u4f1a\u81ea\u52a8\u521b\u5efanginx\u7528\u6237<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>useradd -r -s \/sbin\/nologin nginx<\/code><\/pre>\n\n\n\n<p><strong>\u5b89\u88c5nginx<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt -y install nginx<br>#\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8<br>systemctl enable --now nginx<\/code><\/pre>\n\n\n\n<p><strong>\u4fee\u6539nginx\u7684\u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n\n\n\n<p>\u4e00\u822c\u914d\u7f6e\u6587\u4ef6\u4f1a\u653e\u5728\uff1a\/etc\/nginx\/nginx.conf \/etc\/nginx\/conf.d\/ \/etc\/nginx\/sites-enabled\/ \u7b49\u6587\u4ef6\u5939\u91cc\u3002\u6211\u4eec\u9700\u8981\u627e\u5230\u5305\u542bserver\u5757\u7684\u914d\u7f6e\u6587\u4ef6\u5e76\u4fee\u6539\u5b83\u3002Debian\u548cUbuntu\u7684\u7cfb\u7edf\uff0c\u4e00\u822c\u4fee\u6539\u4ee5\u4e0b\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/nginx\/sites-enabled\/default<\/code><\/pre>\n\n\n\n<p><strong>\u4fee\u6539server\u5757<\/strong><\/p>\n\n\n\n<p>\u7f51\u7ad9\u6839\u76ee\u5f55\u8bbe\u4e3awordpress\u6587\u4ef6\u5939\u3002<\/p>\n\n\n\n<p>\u4e3b\u9875\u6dfb\u52a0\u4e0aindex.php\u3002<\/p>\n\n\n\n<p>\u7531\u4e8enginx\u672c\u8eab\u65e0\u6cd5\u5904\u7406php\u8bf7\u6c42\uff0c\u8fd9\u91cc\u914d\u7f6e\u5229\u7528nginx\u7684\u53cd\u5411\u4ee3\u7406\u529f\u80fd\uff0c\u628a\u5339\u914d\u5230\u7684PHP\u8bf7\u6c42\u901a\u8fc7fastcgi\u534f\u8bae\u8f6c\u53d1\u7ed9php-fpm\u8fdb\u7a0b\u6765\u5904\u7406\u3002<\/p>\n\n\n\n<p>\u5176\u4ed6\u7684\u9ed8\u8ba4\u914d\u7f6e\u53ef\u4ee5\u4e0d\u7528\u6539\u52a8\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {<br>  listen  80;<br>  location \/ {<br> &nbsp;  root &nbsp; \/var\/www\/wordpress;<br> &nbsp;  index  index.php index.html index.htm;<br>}<br>  location ~ \\.php$ {<br> &nbsp;  root &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/var\/www\/wordpress;<br> &nbsp;  fastcgi_pass &nbsp; 127.0.0.1:9000;<br> &nbsp;  fastcgi_index  index.php;<br> &nbsp;  fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;<br> &nbsp;  include &nbsp; &nbsp; &nbsp;  fastcgi_params;<br> &nbsp;  }<br>\u200b<br>}<\/code><\/pre>\n\n\n\n<p><strong>\u518d\u53bb\u4e3b\u914d\u7f6e\u6587\u4ef6\u770b\u4e00\u773c\u786e\u4fdd\u542f\u52a8\u670d\u52a1\u7684\u7528\u6237\u662fnginx<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/nginx\/nginx.conf<\/code><\/pre>\n\n\n\n<p><strong>\u786e\u4fdd\u5168\u5c40\u914d\u7f6e\u8fd9\u91cc\u7528\u6237\u662fnginx<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>user nginx;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b89\u88c5MYSQL\u6570\u636e\u5e93<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt -y install mysql-server<br>#\u5982\u679c\u4e0a\u8ff0\u547d\u4ee4\u62a5\u9519\u663e\u793a\u6ca1\u6709\u8fd9\u4e2a\u5305\uff0c\u5c31\u5b89\u88c5 mariadb-server\u4f5c\u4e3a\u66ff\u4ee3 \u7528\u8d77\u6765\u90fd\u5dee\u4e0d\u591a<br>systemctl enable --now mysql<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u597d\u4ee5\u540e\u7528root\u8eab\u4efd\u8fde\u63a5\u6570\u636e\u5e93\uff0c\u9ed8\u8ba4\u5bc6\u7801\u4e3a\u7a7a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -uroot <\/code><\/pre>\n\n\n\n<p>\u8fdb\u53bb\u4ee5\u540e\u521b\u5efawordpress\u6570\u636e\u5e93\uff0c\u8fd9\u4e2a\u6570\u636e\u5e93\u5c31\u662f\u7ed9wordpress\u7f51\u7ad9\u7528\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE DATABASE wordpress;<\/code><\/pre>\n\n\n\n<p>\u6709\u4e86\u6570\u636e\u5e93\uff0c\u8fd8\u9700\u8981\u4e00\u4e2a\u4f7f\u7528\u5b83\u7684\u7528\u6237\u3002\u521b\u5efawordpress\u7528\u6237\uff0c\u5e76\u4e14\u628awordpress\u6570\u636e\u5e93\u7684\u6240\u6709\u6743\u9650\u90fd\u6388\u6743\u7ed9\u5b83\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER wordpress@\"127.0.0.1\" identified by \"123456\";  #\u5bc6\u7801\u6539\u6210\u4f60\u9700\u8981\u7684<br>GRANT ALL ON wordpress.* TO wordpress@\"127.0.0.1\";<br>exit;#\u914d\u7f6e\u5b8c\u4e86\u9000\u51fa\u6570\u636e\u5e93<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6837\u6570\u636e\u5e93\u5c31\u914d\u7f6e\u5b8c\u4e86\uff0c\u8bb0\u4f4f\u7528\u6237\u5bc6\u7801\u548c\u8fd9\u4e2a127.0.0.1\uff0c\u5b89\u88c5wordpress\u4f1a\u7528\u5b83\u6765\u8fde\u63a5\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b89\u88c5php-fpm php-mysql php-xml php-gd<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt -y install php-fpm php-mysql php-xml php-gd<br>systemctl enable --now php7.4-fpm<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539PHP\u7684\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/php\/7.4\/fpm\/pool.d\/www.conf<\/code><\/pre>\n\n\n\n<p>\u627e\u5230\u8fd9\u4e9b\u5730\u65b9\u5e76\u4e14\u4fee\u6539<\/p>\n\n\n\n<p>\u628asocket\u8fde\u63a5\u6ce8\u91ca\u6389<\/p>\n\n\n\n<p>\u8ba9php\u670d\u52a1\u76d1\u542c\u672c\u5730\u7684TCP 9000\u7aef\u53e3<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>user = nginx<br>group = nginx<br>\u200b<br>;listen = \/run\/php\/php7.4-fpm.sock<br>listen = 127.0.0.1:9000<\/code><\/pre>\n\n\n\n<p>\u91cd\u542fphp\u670d\u52a1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart php7.4-fpm<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u914d\u7f6e\u6ca1\u95ee\u9898\u7684\u8bdd\u4f7f\u7528ss -ntl \u547d\u4ee4\u53ef\u4ee5\u770b\u52309000\u7aef\u53e3\u5df2\u7ecf\u6253\u5f00\uff0c\u8fd9\u8868\u793aPHP\u670d\u52a1\u5f00\u59cb\u5de5\u4f5c\u4e86\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"146\" src=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a2-1024x146.jpg\" alt=\"\" class=\"wp-image-194\" srcset=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a2-1024x146.jpg 1024w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a2-300x43.jpg 300w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a2-768x110.jpg 768w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a2.jpg 1408w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b89\u88c5wordpress<\/h2>\n\n\n\n<p>\u8fd9\u4e2a\u65f6\u5019LNMP\u67b6\u6784\u5c31\u5df2\u7ecf\u642d\u597d\u4e86\uff0c\u73b0\u5728\u53ea\u9700\u8981\u53bb\u4e0b\u8f7dwordpress\u7684\u6e90\u7801\u7136\u540e\u89e3\u538b\u5230\u7f51\u7ad9\u6839\u76ee\u5f55\u4e0b\uff0c\u5c31\u53ef\u4ee5\u5f00\u59cb\u5b89\u88c5\u4e86\u3002\u7531\u4e8e\u6211\u914d\u7f6e\u7684\u7f51\u7ad9\u6839\u76ee\u5f55\u662fwordpress\uff0c\u7136\u540e\u8fd9\u4e2a\u538b\u7f29\u5305\u89e3\u538b\u51fa\u6765\u521a\u597d\u5c31\u662f\u4e00\u6574\u4e2awordpress\u6587\u4ef6\u5939\uff0c\u6240\u4ee5\u79fb\u52a8\u5230\/var\/www \u76ee\u5f55\u4e0b\u5c31\u53ef\u4ee5\u76f4\u63a5\u7528\u4e86\u3002\u6ca1\u6709\u76ee\u5f55\u7684\u8bdd\u5c31\u5148\u521b\u5efa\u76ee\u5f55\u3002\u91cd\u70b9\u662f\uff1a\u79fb\u52a8\u5b8c\u4e86\u8981\u628a\u7f51\u7ad9\u6587\u4ef6\u5939\u7684\u6240\u6709\u8005\u6539\u6210nginx\uff0c\u4e0d\u7136\u7b49\u4e0b\u5b89\u88c5\u7684\u65f6\u5019\u65e0\u6cd5\u5199\u6587\u4ef6\u7cfb\u7edf\u4f1a\u62a5\u9519\u3002<\/p>\n\n\n\n<p><strong>\u4e0b\u8f7dwordpress\u89e3\u538b\u540e\u79fb\u52a8\u5230\u6307\u5b9a\u76ee\u5f55<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/local\/src<br>wget https:\/\/cn.wordpress.org\/latest-zh_CN.tar.gz<br>tar xvf latest-zh_CN.tar.gz<br>mv wordpress\/ \/var\/www\/<br>chown -R nginx.nginx \/var\/www\/wordpress<\/code><\/pre>\n\n\n\n<p><strong>\u91cd\u542f\u670d\u52a1\uff0c\u5173\u95ed\u9632\u706b\u5899<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart nginx<br>systemctl restart mysql<br>systemctl disable --now ufw<\/code><\/pre>\n\n\n\n<p><strong>\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee\u670d\u52a1\u5668<\/strong><\/p>\n\n\n\n<p>\u770b\u5230\u8fd9\u4e2a\u9875\u9762\u5c31\u662f\u914d\u7f6e\u5bf9\u4e86\uff0c\u586b\u5199\u76f8\u5173\u4fe1\u606f\uff0c\u5b89\u88c5\u597d\u5c31\u53ef\u4ee5\u8d77\u98de\u4e86\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"723\" src=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a3-1024x723.jpg\" alt=\"\" class=\"wp-image-195\" srcset=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a3-1024x723.jpg 1024w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a3-300x212.jpg 300w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a3-768x542.jpg 768w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a3.jpg 1117w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"825\" src=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20220430a4-1024x825.jpg\" alt=\"\" class=\"wp-image-196\" srcset=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20220430a4-1024x825.jpg 1024w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20220430a4-300x242.jpg 300w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20220430a4-768x619.jpg 768w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20220430a4.jpg 1079w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" src=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a5-1024x551.jpg\" alt=\"\" class=\"wp-image-197\" srcset=\"https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a5-1024x551.jpg 1024w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a5-300x161.jpg 300w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a5-768x413.jpg 768w, https:\/\/frogvps.com\/wp-content\/uploads\/2022\/05\/20200430a5.jpg 1062w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>LNMP\u67b6\u6784\u4ecb\u7ecd LNMP\u67b6\u6784\uff0c\u7b80\u5355\u5730\u6765\u8bf4\u5c31\u662flinux \u7cfb\u7edf + Nginx web\u670d\u52a1\u5668 + MYSQL \u6570\u636e\u5e93 +PHP \u670d\u52a1\u3002\u672c\u7ad9\u4f7f\u7528\u7684\u5c31\u662f\u8fd9\u4e2a\u67b6\u6784\uff0c\u642d\u5efa\u5b8cLNMP\u6211\u4eec\u5c31\u53ef\u4ee5\u7528wordpress\u6765\u5efa\u7acb\u81ea\u5df1\u7684\u7f51\u7ad9\u4e86\uff0cLNMP\u600e\u4e48\u642d\u5efa\uff1f&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[15,20,14,21],"topic":[],"class_list":["post-76","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux","tag-lnmp","tag-nginx","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/frogvps.com\/index.php?rest_route=\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frogvps.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frogvps.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frogvps.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frogvps.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76"}],"version-history":[{"count":3,"href":"https:\/\/frogvps.com\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":198,"href":"https:\/\/frogvps.com\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions\/198"}],"wp:attachment":[{"href":"https:\/\/frogvps.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frogvps.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frogvps.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/frogvps.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}