{"id":97,"date":"2019-07-02T11:12:23","date_gmt":"2019-07-02T03:12:23","guid":{"rendered":"https:\/\/www.overwatchss.club\/?p=97"},"modified":"2019-07-02T11:12:50","modified_gmt":"2019-07-02T03:12:50","slug":"wordpress%e6%90%ad%e5%bb%ba%ef%bc%88%e4%b8%80%ef%bc%89-%e8%ae%b0%e5%bd%95lnmp%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/www.overwatchss.club\/?p=97","title":{"rendered":"WordPress\u642d\u5efa\uff08\u4e00\uff09&#8211;\u8bb0\u5f55LNMP\u73af\u5883"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u5e8f\u8a00<\/h2>\n\n\n\n<p>  \u4f17\u6240\u5468\u77e5\u4e00\u4e2a\u7f51\u7ad9\u662f\u79bb\u4e0d\u5f00WEB\u73af\u5883\u7684\uff0c\u800c\u642d\u5efaWordPress\u7684\u57fa\u7840\u5728\u4e8e\u5982\u4f55\u642d\u5efa\u597d\u81ea\u5df1\u7684LNMP\u73af\u5883\uff08L\uff1aLinux   N\uff1aNginx  M:Mysql\u6216MariaDB  P:PHP\uff09\u3002\u672c\u6587\u4ee5Ubuntu18.04\u4e3a\u4f8b\uff0c\u642d\u5efa\u5c5e\u4e8e\u81ea\u5df1\u7684LNMP\u73af\u5883\u53ca\u5176\u73af\u5883\u914d\u7f6e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\uff1a\u66f4\u65b0\u81ea\u5df1\u7684Ubuntu<\/h2>\n\n\n\n<p>  \u5728\u642d\u5efa\u4efb\u4f55\u590d\u6742\u7684Linux\u914d\u7f6e\u4e4b\u524dupdate\u4e00\u4e0bubuntu\u603b\u662f\u597d\u7684\uff0c\u6240\u4ee5\u9996\u5148\u952e\u5165\u4e0b\u5217\u547d\u4ee4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update &amp;&amp; apt-get dist-upgrade &amp;&amp; sudo apt autoremove<\/code><\/pre>\n\n\n\n<p>  \u66f4\u65b0\u5b8c\u6210\u540e\uff0c\u7ee7\u7eed\u4e0b\u9762\u7684\u6b65\u9aa4\u5b89\u88c5LNMP\u5404\u4e2a\u7ec4\u4ef6\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\uff1a\u5b89\u88c5Nginx Web Server<\/h2>\n\n\n\n<p>  \u5728\u8fdb\u884c\u5b8c\u4e0a\u4e00\u6b65\u5347\u7ea7ubuntu\u4e4b\u540e\uff0c\u518d\u6b21\u952e\u5165\u4e0b\u5217\u4ee3\u7801\u5b89\u88c5Nginx Web Server\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install nginx<\/code><\/pre>\n\n\n\n<p style=\"text-align:left\">    \u5b89\u88c5Nginx\u4e4b\u540e\uff0c\u4e0b\u5217\u547d\u4ee4\u7528\u4e8e\u505c\u6b62\u3001\u542f\u52a8\u548c\u5f00\u673a\u81ea\u542fNginx\u670d\u52a1\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>sudo systemctl stop nginx.service<\/li><li>sudo systemctl start nginx.service<\/li><li>sudo systemctl enable nginx.service<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\uff1a\u5b89\u88c5MariaDB Database Server<\/h2>\n\n\n\n<p>  \u672c\u6b21\u4f7f\u7528\u7684\u6570\u636e\u5e93\u7ba1\u7406\u8f6f\u4ef6\u662fMariaDb\uff0c\u4f7f\u7528\u5b83\u7684\u539f\u56e0\u5728\u4e8e\u5b83\u7684\u901f\u5ea6\u8981\u660e\u663e\u4f18\u4e8eMysql\uff0c\u4f7f\u7528\u4e0b\u5217\u547d\u4ee4\u6765\u5b89\u88c5\u6211\u4eec\u7684MariaDB\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install mariadb-server mariadb-client<\/code><\/pre>\n\n\n\n<p>   \u5b89\u88c5Mariadb\u4e4b\u540e\uff0c\u4e0b\u5217\u547d\u4ee4\u7528\u4e8e\u505c\u6b62\u3001\u542f\u52a8\u548c\u5f00\u673a\u81ea\u542fMariadb\u670d\u52a1\u3002 <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>sudo systemctl stop mariadb.service<\/li><li>sudo systemctl start mariadb.service<\/li><li>sudo systemctl enable mariadb.service<\/li><\/ul>\n\n\n\n<p>  \u5b89\u88c5\u5b8cMariadb\u4e4b\u540e\uff0c\u6211\u4eec\u952e\u5165\u4e0b\u5217\u547d\u4ee4\u4e3aMariadb\u521b\u5efaroot\u5bc6\u7801\u5e76\u4e14\u4fee\u6539\u914d\u7f6e\u6765\u4fdd\u62a4\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql_secure_installation<\/code><\/pre>\n\n\n\n<p>  \u952e\u5165\u4e0a\u9762\u7684\u547d\u4ee4\u4e4b\u540e\uff0c\u6309\u7167\u63d0\u793a\u4f9d\u6b21\u56de\u7b54\u4e0b\u5217\u95ee\u9898:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> Enter current password for root (enter for none): Just\u00a0press\u00a0Enter <\/li><li> Set root password? [Y\/n]:\u00a0Y <\/li><li> New password:\u00a0\u201c\u6b64\u5904\u66ff\u6362\u4e3a\u4f60\u8981\u8bbe\u7f6e\u7684\u5bc6\u7801\u201d<\/li><li> Re-enter new password:\u00a0\u201c\u91cd\u65b0\u786e\u8ba4\u5bc6\u7801\u201d<\/li><li> Remove anonymous users? [Y\/n]:\u00a0Y <\/li><li> Disallow root login remotely? [Y\/n]:\u00a0Y <\/li><li> Remove test database and access to it? [Y\/n]:\u00a0\u00a0Y <\/li><li> Reload privilege tables now? [Y\/n]: \u00a0Y <\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\uff1a\u5b89\u88c5PHP-FPM\u548c\u76f8\u5173\u7684\u6a21\u5757<\/h2>\n\n\n\n<p>  \u7ecf\u8fc7\u4e0a\u9762\u7684\u64cd\u4f5c\uff0c\u670d\u52a1\u5668\u5df2\u7ecf\u5b89\u88c5\u4e86Nginx\u548cMariadb\u6a21\u5757\uff0c\u952e\u5165\u4e0b\u5217\u547d\u4ee4\u6765\u5b89\u88c5PHP-FPM\u548c\u76f8\u5173\u7684\u6a21\u5757\uff0c\u4e0b\u884c\u547d\u4ee4\u63d0\u4f9b\u4e86PHP-FPM\u4ee5\u53ca\u5404\u4e2a\u6a21\u5757\u7684\u5b89\u88c5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php-fpm php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-ldap php-zip php-curl<\/code><\/pre>\n\n\n\n<p>  \u5b89\u88c5PHP\u4e4b\u540e\uff0c\u6211\u4eec\u9700\u8981\u7f16\u8f91PHP-FPM\u7684\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vim \/etc\/php\/7.2\/fpm\/php.ini<\/code><\/pre>\n\n\n\n<p>\u627e\u5230\u4e0b\u5217\u5217\u8868\u7684\u5bf9\u5e94\u9009\u9879\u5e76\u4fee\u6539\u5bf9\u5e94\u503c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>post_max_size = 100M  \nmemory_limit = 256M  \/*\u8fd0\u884cphp\u7684\u6700\u5927\u5185\u5b58\u9650\u5236\uff0c\u4f4e\u5185\u5b58\u670d\u52a1\u5668\u53ef\u964d\u4f4e\u6b64\u9009\u9879*\/\nmax_execution_time = 360\nupload_max_filesize = 100M  \/*\u6700\u5927\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f\u9650\u5236*\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e94\uff1a\u4e3aWordPress\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5e93<\/h2>\n\n\n\n<p>  \u7ecf\u8fc7\u4e0a\u9762\u56db\u4e2a\u6b65\u9aa4\uff0c\u670d\u52a1\u5668\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u597d\u4e86LNMP\u73af\u5883\u548cWordPress\u7684\u57fa\u7840\u7ec4\u4ef6\u3002\u73b0\u5728\u6211\u4eec\u9700\u8981\u5728\u670d\u52a1\u5668\u4e0a\u4e3aWordPress\u521b\u5efa\u4e00\u4e2a\u6570\u636e\u5e93\uff0cWordPress\u5c06\u4f7f\u7528\u6b64\u6570\u636e\u5e93\u6765\u5b58\u50a8\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>  \u8fd0\u884c\u4e0b\u9762\u547d\u4ee4\u6765\u767b\u5f55Mariadb\u6570\u636e\u5e93\u670d\u52a1\u5668\uff0c\u8f93\u5165\u7b2c\u4e09\u6b65\u4e2d\u8bbe\u7f6e\u7684Mariadb\u7684root\u5bc6\u7801\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql -u root -p<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"143\" src=\"https:\/\/www.overwatchss.club\/wp-content\/uploads\/2019\/07\/Mariadb.png\" alt=\"\" class=\"wp-image-107\" srcset=\"https:\/\/www.overwatchss.club\/wp-content\/uploads\/2019\/07\/Mariadb.png 567w, https:\/\/www.overwatchss.club\/wp-content\/uploads\/2019\/07\/Mariadb-300x76.png 300w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><figcaption>\u767b\u5f55 Mariadb \u540e\u7684\u754c\u9762<\/figcaption><\/figure><\/div>\n\n\n\n<p>  \u7136\u540e\u8f93\u5165\u4e0b\u5217\u4ee3\u7801\u6765\u521b\u5efa\u4e00\u4e2a\u540d\u53ebWP_database\u7684\u7a7a\u767d\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<p> CREATE DATABASE WP_database; <\/p>\n\n\n\n<p>  \u4e3aWP_database1\u6570\u636e\u5e93\u521b\u5efa\u4e00\u4e2a\u540d\u53eb\u201cwp_user\u201d\u7684\u7528\u6237\u5e76\u4e14\u8bbe\u7f6e\u5bc6\u7801\u201cpassword\u201d\u3002(wp_user\u4e0epassword\u6839\u636e\u81ea\u5df1\u6765\u8bbe\u7f6e)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'password';<\/code><\/pre>\n\n\n\n<p>  \u7136\u540e\u6388\u4e88\u6b64\u7528\u6237\u5bf9WP_database\u6570\u636e\u5e93\u7684\u5b8c\u5168\u8bbf\u95ee\u6743\u9650.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT ALL ON WP_database.* TO 'wp_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;<\/code><\/pre>\n\n\n\n<p>  \u6700\u540e\uff0c\u4fdd\u5b58\u66f4\u6539\u7684\u5185\u5bb9\u5e76\u66f4\u65b0\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FLUSH PRIVILEGES;\nEXIT;<\/code><\/pre>\n\n\n\n<p>  \u81f3\u6b64\uff0c\u6211\u4eec\u5df2\u7ecf\u5b8c\u6210\u4e86LNMP\u73af\u5883\u548c\u6570\u636e\u5e93\u7684\u914d\u7f6e\uff0c\u4e0b\u4e00\u7ae0\u8bb2\u89e3\u5b89\u88c5wordpress\uff0c\u57df\u540d\u7684\u8d2d\u4e70\uff0cDNS\u7684\u89e3\u6790\uff0c\u89e3\u6790\u57df\u540d\u5230\u81ea\u5df1\u7684\u670d\u52a1\u5668\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5e8f\u8a00 \u4f17\u6240\u5468\u77e5\u4e00\u4e2a\u7f51\u7ad9\u662f\u79bb\u4e0d\u5f00WEB\u73af\u5883\u7684\uff0c\u800c\u642d\u5efaWordPress\u7684\u57fa\u7840\u5728\u4e8e\u5982\u4f55\u642d\u5efa\u597d\u81ea\u5df1\u7684LNMP\u73af\u5883\uff08L\uff1aLinux N\uff1aN &#8230;<\/p>\n","protected":false},"author":1,"featured_media":106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[10],"tags":[21,22],"class_list":["post-97","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-lnmp","tag-wordpress"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":0,"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=\/wp\/v2\/media\/106"}],"wp:attachment":[{"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.overwatchss.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}