{"id":123,"date":"2021-09-23T23:13:48","date_gmt":"2021-09-23T15:13:48","guid":{"rendered":"https:\/\/dailyrenewblog.com\/?p=123"},"modified":"2021-09-23T23:13:48","modified_gmt":"2021-09-23T15:13:48","slug":"debian11%e5%ae%89%e8%a3%85wordpress","status":"publish","type":"post","link":"https:\/\/dailyrenewblog.com\/?p=123","title":{"rendered":"\u642d\u5efaWordPress(LAMP\u73af\u5883)"},"content":{"rendered":"\n<p>1.LAMP\u73af\u5883\u5b89\u88c5<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u672c\u4f8b\u4e2d\u7cfb\u7edfDebian11<\/li>\n<\/ul>\n\n\n\n<p><code>sudo apt update &amp;&amp; sudo apt upgrade<\/code><\/p>\n\n\n\n<p> <code>sudo apt install -y apache2 apache2-utils mariadb-server mariadb-client php7.4 php7.4-fpm libapache2-mod-php7.4 php7.4-mysql php7.4-mbstring php7.4-cli php7.4-xml  php7.4-common php7.4-gd php7.4-bcmath php7.4-json php7.4-opcache php7.4-readline php7.4-curl php7.4-zip unzip<\/code><\/p>\n\n\n\n<p>\u8fd0\u884cMariaDB\u524d\u9996\u6b21\u914d\u7f6e<\/p>\n\n\n\n<p> <code>sudo mysql_secure_installation<\/code><\/p>\n\n\n\n<p>php-handler\u914d\u7f6e\uff0c\u5982\u9700\u8981\u5c06\u6765\u542f\u7528HTTP\/2,php-handler\u9700\u5207\u6362\u4e3aphp-fpm<\/p>\n\n\n\n<p><code>sudo a2dismod php7.4<br> sudo a2dismod mpm_prefork<br> sudo a2enmod mpm_event proxy_fcgi setenvif<br> sudo a2enconf php7.4-fpm<\/code><\/p>\n\n\n\n<p>2.\u4e0b\u8f7d\u5e76\u914d\u7f6ewordpress<\/p>\n\n\n\n<p><code>wget https:\/\/wordpress.org\/latest.zip &amp;&amp; sudo unzip latest.zip -d \/var\/www\/<\/code><\/p>\n\n\n\n<p>\u4e3awordpress\u521b\u5efa\u6570\u636e\u5e93<\/p>\n\n\n\n<p><code> sudo mariadb -u root <\/code><\/p>\n\n\n\n<p><code>create database <em><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">wordpress<\/mark><\/strong><\/em>;<\/code><br><code>grant all privileges on <em><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">wordpress<\/mark><\/strong><\/em>.* to <em><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">wpuser<\/mark><\/strong><\/em>@localhost identified by '<em><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">your-password<\/mark><\/strong><\/em>';<br>flush privileges;<br>exit;<\/code><\/p>\n\n\n\n<p>\u914d\u7f6ewordpress<\/p>\n\n\n\n<p><code>sudo cp \/var\/www\/wordpress\/wp-config-sample.php \/var\/www\/wordpress\/wp-config.php<\/code><\/p>\n\n\n\n<p><code>sudo sed -i 's\/database_name_here\/<em><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">wordpress<\/mark><\/strong><\/em>\/g' \/var\/www\/wordpress\/wp-config.php<\/code><br><code>sudo sed -i 's\/username_here\/<em><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">wpuser<\/mark><\/strong><\/em>\/g' \/var\/www\/wordpress\/wp-config.php<br>sudo sed -i 's\/password_here\/<em><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">your-password<\/mark><\/strong><\/em>\/g' \/var\/www\/wordpress\/wp-config.php<\/code><\/p>\n\n\n\n<p> \u4e3a\u786e\u4fddApache2\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>3.\u914d\u7f6eApache2<\/p>\n\n\n\n<p><a href=\"https:\/\/dailyrenewblog.com\/2020\/01\/04\/nginx%e5%bc%80%e5%90%aftls%ef%bc%8c%e5%bc%80%e5%90%afrsaecc%e5%8f%8c%e6%b3%9b%e5%9f%9f%e5%90%8d%e8%af%81%e4%b9%a6%ef%bc%8c%e5%90%af%e7%94%a8hstsocsp-stapling\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u7b7e\u53d1ECC+RSA\u53ccTLS\u8bc1\u4e66<\/a><\/p>\n\n\n\n<p>\u521b\u5efaApache2\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p><code>sudo touch \/etc\/apache2\/sites-available\/wordpress.conf<\/code><\/p>\n\n\n\n<p>\u5c06\u4ee5\u4e0b\u5185\u5bb9\u7c98\u8d34\u8fdb<code>\/etc\/apache2\/sites-available\/wordpress.conf<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n    RewriteEngine On\n    RewriteCond %{REQUEST_URI} !^\/\\.well\\-known\/acme\\-challenge\/\n    RewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}$1 &#91;R=301,L]\n&lt;\/VirtualHost&gt;\n&lt;VirtualHost *:443&gt;\n    SSLEngine on\n    SSLCertificateFile      <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><em>\/path\/yourdomain.com.crt<\/em><\/mark>\n    SSLCertificateKeyFile   <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><em>\/path\/yourdomain.com.key<\/em><\/mark>\n    Protocols h2 http\/1.1\n    Header always set Strict-Transport-Security \"max-age=63072000\"\n        ServerName <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">yourdomain.com<\/mark><\/em>\n        ServerAlias <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">www.yourdomain.com<\/mark><\/em>\n        DocumentRoot \/var\/www\/wordpress\n        #This enables .htaccess file, which is needed for WordPress Permalink to\n        &lt;Directory \"\/var\/www\/wordpress\"&gt;\n             AllowOverride All\n        &lt;\/Directory&gt;\n        ErrorLog ${APACHE_LOG_DIR}\/wordpress.error.log\n        CustomLog ${APACHE_LOG_DIR}\/wordpress.access.log combined\n&lt;\/VirtualHost&gt;\nSSLProtocol             all -SSLv3 -TLSv1 -TLSv1.1\nSSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305\nSSLHonorCipherOrder     on\nSSLSessionTickets       off\nSSLUseStapling On\nSSLStaplingCache \"shmcb:logs\/ssl_stapling(32768)\"<\/code><\/pre>\n\n\n\n<p>\u6d4b\u8bd5apache2\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u51fa\u9519<\/p>\n\n\n\n<p><code>sudo apache2ctl configtest<\/code><\/p>\n\n\n\n<p>\u542f\u7528\u6a21\u5757<\/p>\n\n\n\n<p><code>sudo a2enmod rewrite<br>sudo a2enmod headers<br>sudo a2enmod ssl<br>sudo a2enmod http2<\/code><\/p>\n\n\n\n<p>\u7981\u7528apache2\u9ed8\u8ba4\u9875\u9762\uff0c\u542f\u7528wordpress\u914d\u7f6e<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p><code>sudo a2dissite 000-default<br>sudo a2dissite default-ssl.conf<br>sudo a2ensite wordpress<br>sudo systemctl reload apache2<\/code><\/p>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1.LAMP\u73af\u5883\u5b89\u88c5 sudo apt update &amp;&amp; sudo apt upgrade  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,6],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-apache2","category-web-server"],"_links":{"self":[{"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=\/wp\/v2\/posts\/123","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=123"}],"version-history":[{"count":0,"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions"}],"wp:attachment":[{"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dailyrenewblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}