{"id":88,"date":"2019-12-22T17:09:31","date_gmt":"2019-12-22T09:09:31","guid":{"rendered":"https:\/\/dailyrenewblog.com\/?p=88"},"modified":"2019-12-22T17:09:31","modified_gmt":"2019-12-22T09:09:31","slug":"debian10%e5%ae%89%e8%a3%85wordpress","status":"publish","type":"post","link":"https:\/\/dailyrenewblog.com\/?p=88","title":{"rendered":"\u642d\u5efaWordPress(LEMP\u73af\u5883)"},"content":{"rendered":"\n<p>LEMP\u73af\u5883\u7684\u5b89\u88c5<\/p>\n\n\n\n<p>1.LEMP\u73af\u5883\u6307 <strong>L<\/strong>inux,\u00a0<strong>N<\/strong>ginx,\u00a0<strong>M<\/strong>ariaDB\u6216\u8005<strong>M<\/strong>ySQL \u4ee5\u53ca <strong>P<\/strong>HP\uff0c\u672c\u4f8b\u4e2d\u7cfb\u7edfDebian 10<\/p>\n\n\n\n<p>2.\u66f4\u65b0\u8f6f\u4ef6\u5305 <\/p>\n\n\n\n<p><code>sudo apt update &amp;&amp; sudo apt upgrade<\/code><\/p>\n\n\n\n<p>3.\u5b89\u88c5Nginx,MariaDB,php7.3<\/p>\n\n\n\n<p><code>sudo apt install -y nginx-extras mariadb-server mariadb-client php7.3 php7.3-fpm php7.3-mysql php-common php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline<\/code><\/p>\n\n\n\n<p>4. MariaDB\u7684\u521d\u59cb\u5316\u914d\u7f6e<\/p>\n\n\n\n<p><code>sudo mysql_secure_installation<\/code><\/p>\n\n\n\n<p>\u6839\u636e\u63d0\u793a\u8bbe\u5b9aMariaDB\u7684root\u5bc6\u7801<\/p>\n\n\n\n<p>5.Wordpress\u7684\u76ee\u5f55\u5b89\u88c5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y curl wget unzip &amp;&amp; curl -O https:\/\/wordpress.org\/latest.zip &amp;&amp; unzip latest.zip -d \/var\/www\/<\/code><\/pre>\n\n\n\n<p>6.\u4e3awordpress\u521b\u5efa\u4e00\u4e2aMariaDB\u6570\u636e\u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql -u root\n\ncreate database <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">wordpress<\/mark>;\ngrant all privileges on <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">wordpress<\/mark>.* to <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">wordpressadmin<\/mark>@localhost identified by '<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">your-password<\/mark>';\nflush privileges;\nexit;<\/code><\/pre>\n\n\n\n<p>7.\u8bbe\u7f6ewordpress<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp \/var\/www\/wordpress\/wp-config-sample.php \/var\/www\/wordpress\/wp-config.php\nsudo sed -i 's\/database_name_here\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">wordpress<\/mark>\/g' \/var\/www\/wordpress\/wp-config.php\nsudo sed -i 's\/username_here\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">wordpressadmin<\/mark>\/g' \/var\/www\/wordpress\/wp-config.php\nsudo sed -i 's\/password_here\/<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">your-password<\/mark>\/g' \/var\/www\/wordpress\/wp-config.php<\/code><\/pre>\n\n\n\n<p> \u4e3a\u786e\u4fddnginx\u6709\u6743\u9650\u5199\u5165wordpress\u6839\u76ee\u5f55\uff0c\u9700\u4fee\u6539wordpress\u6839\u76ee\u5f55\u6240\u6709\u8005 <\/p>\n\n\n\n<p><code>sudo chown www-data:www-data \/var\/www\/wordpress\/ -R<\/code><\/p>\n\n\n\n<p>8.\u4e3aNginx\u670d\u52a1\u5668<a href=\"https:\/\/dailyrenewblog.com\/2020\/01\/04\/%e7%94%b3%e8%af%b7lets-encrypt%e9%80%9a%e9%85%8d%e7%ac%a6%e8%af%81%e4%b9%a6\/\">\u7b7e\u53d1TLS\u8bc1\u4e66<\/a><\/p>\n\n\n\n<p>9.\u914d\u7f6eNginx\u5e76\u542f\u52a8<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u521b\u5efanginx server\u914d\u7f6e\u6587\u4ef6<\/li>\n<\/ul>\n\n\n\n<p><code>sudo touch \/etc\/nginx\/conf.d\/yourdomain.conf<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5c06\u4ee5\u4e0b\u5185\u5bb9\u7c98\u8d34\u8fdb<code>\/etc\/nginx\/conf.d\/yourdomain.conf<\/code><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>#Upstream to abstract backend connection(s) for php\nupstream php {\n         server unix:\/run\/php\/php7.3-fpm.sock;\n        ## server 127.0.0.1:9000;\n }\nserver {\n     listen 80 default_server;\n     listen &#91;::]:80 default_server;\nreturn 301 https:\/\/$host$request_uri;\n } \n server {\n         ## Your website name goes here.\n         server_name <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><em>yourdomain.com<\/em><\/mark>;\n     # listens both on IPv4 and IPv6 on 443 and enables HTTPS and HTTP\/2 support.\n     # HTTP\/2 is available in nginx 1.9.5 and above.\n     listen 443 ssl http2;\n     listen &#91;::]:443 ssl http2;\n     # indicate locations of SSL key files.\n     ssl_certificate <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\/path\/yourdomain.com.crt<\/mark><\/strong>;\n     ssl_certificate_key <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>\/path\/yourdomain.com.key<\/strong><\/mark>;\n        ## Your only path reference.\n    root \/var\/www\/wordpress;\n    ## This should be in your http block and if it is, it's not needed here.\n    index index.php;\n    location = \/favicon.ico {\n            log_not_found off;\n            access_log off;\n    }\n    location = \/robots.txt {\n            allow all;\n            log_not_found off;\n            access_log off;\n    }\n    location \/ {\n            # This is cool because no php is touched for static content.\n            # include the \"?$args\" part so non-default permalinks doesn't break when using query string\n            try_files $uri $uri\/ \/index.php?$args;\n    }\n    location ~ \\.php$ {\n            #NOTE: You should have \"cgi.fix_pathinfo = 0;\" in php.ini\n            include fastcgi.conf;\n            fastcgi_intercept_errors on;\n            fastcgi_pass php;\n    }\n    location ~* \\.(js|css|png|jpg|jpeg|gif|ico)$ {\n            expires max;\n            log_not_found off;\n    }\n\t}<\/code><\/pre>\n\n\n\n<p>\u542f\u52a8\u5404\u9879\u670d\u52a1<\/p>\n\n\n\n<p><code>sudo nginx -t &amp;&amp; sudo systemctl start nginx &amp;&amp; sudo systemctl enable nginx<\/code><\/p>\n<p><code>sudo systemctl start mariadb &amp;&amp; sudo systemctl enable mariadb<\/code><\/p>\n<p><code>sudo systemctl start php7.3-fpm &amp;&amp; sudo systemctl enable php7.3-fpm<\/code><\/p>\n\n\n\n<p>\u6d4f\u89c8\u5668\u767b\u9646 https:\/\/<em><strong>yourdomain.com<\/strong><\/em>\/wp-admin\/install.php,\u5b8c\u6210\u8bbe\u7f6e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LEMP\u73af\u5883\u7684\u5b89\u88c5 1.LEMP\u73af\u5883\u6307 Linux,\u00a0Nginx,\u00a0MariaDB\u6216\u8005MySQL \u4ee5\u53ca PHP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","hentry","category-nginx"],"_links":{"self":[{"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88"}],"version-history":[{"count":0,"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions"}],"wp:attachment":[{"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}