{"id":34,"date":"2026-10-28T14:25:10","date_gmt":"2026-10-28T06:25:10","guid":{"rendered":"https:\/\/xgz.app\/?p=34"},"modified":"2026-10-28T22:55:23","modified_gmt":"2026-10-28T14:55:23","slug":"%e5%9f%ba%e4%ba%8ealmalinux-8-8%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%89%80%e5%ae%9e%e7%8e%b0%e7%9a%84web%e6%9c%8d%e5%8a%a1%ef%bc%88wordpress%ef%bc%89","status":"publish","type":"post","link":"https:\/\/xgz.app\/?p=34","title":{"rendered":"\u57fa\u4e8eAlmaLinux 8.8\u670d\u52a1\u5668\u6240\u5b9e\u73b0\u7684web\u670d\u52a1\uff08WordPress\uff09"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u547d\u4ee4\u8865\u5168<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u521a\u4e70\u7684\u670d\u52a1\u5668\u6ca1\u6709\u8fd9\u9879\u529f\u80fd\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u4e0b\u8f7d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# dnf install -y bash-completion\n&#91;root@localhost ~]# source \/etc\/profile.d\/bash_completion.sh<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b89\u5168\u9632\u62a4<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\u5148\u5229\u7528SSH\u8f93\u5165IP\u5730\u5740\u6765\u8fde\u63a5\u4f60\u7684\u670d\u52a1\u5668\uff0c\u540c\u65f6\uff0c\u65b0\u4e70\u7684\u670d\u52a1\u5668\u8981<strong>\u5148\u6784\u7b51\u9632\u5fa1\u63aa\u65bd<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# firewall-cmd --permanent --add-service=http\n\n&#91;root@localhost ~]# firewall-cmd --permanent --add-service=https\n\n&#91;root@localhost ~]# firewall-cmd --reload\n\n&#91;root@localhost ~]# firewall-cmd --list-services\ncockpit dhcpv6-client http https ssh\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u597d\uff0c\u5b89\u5168\u670d\u52a1\u57fa\u672c\u5b8c\u6210<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8f6f\u4ef6\u4e0b\u8f7d<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u9700\u8981\u8fd9\u56db\u4e2a\u8f6f\u4ef6<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>nginx<\/li>\n\n\n\n<li>php83-php-fpm<\/li>\n\n\n\n<li>php83-php-mysqlnd<\/li>\n\n\n\n<li>mariadb-server<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e9b\u662f\u8ba9\u52a8\u6001\u7f51\u7ad9\u80fd\u8dd1\u8d77\u6765\u7684\u8f6f\u4ef6<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4e0b\u8f7d\u8f6f\u4ef6\u524d\u9700\u8981\u66f4\u65b0\u8f6f\u4ef6\u6e90<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\u660e\u786e\u4e00\u70b9\uff0c\u6211\u4eec\u9700\u8981PHP8.3\uff0cRemi \u5546\u5e97\u91cc\u6709PHP 8.3\uff0c\u4f46\u662fRemi \u91cc\u6709\u4e9b\u5305\u4f9d\u8d56 EPEL \u91cc\u7684\u4e1c\u897f\uff0c\u4e0d\u5148\u88c5 EPEL\uff0cRemi \u53ef\u80fd\u88c5\u4e0d\u5168\u3002\u6240\u4ee5<strong>\u9700\u8981\u5148\u88c5EPEL\uff0c\u518d\u88c5Remi<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# dnf install -y https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-8.noarch.rpm\n\n&#91;root@localhost ~]# dnf install -y https:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm                  <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u5728\u5b89\u88c5\u65f6\u62a5\u9519\uff0c\u53ef\u80fd\u662fAlmaLinux \u7cfb\u7edf\u81ea\u5e26\u7684 GPG \u5bc6\u94a5\u8fc7\u671f\/\u4e0d\u5339\u914d\uff0c\u5bfc\u81f4\u5b83\u5728\u5c1d\u8bd5\u5347\u7ea7 almalinux-release\u8fd9\u4e2a\u57fa\u7840\u5305\u65f6\u9a8c\u7b7e\u5931\u8d25\uff0c\u6574\u4e2a\u5b89\u88c5\u4e8b\u52a1\u88ab\u62e6\u4e0b\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# rpm --import https:\/\/repo.almalinux.org\/almalinux\/RPM-GPG-KEY-AlmaLinux\n# \u4ece AlmaLinux \u5b98\u65b9\u4e0b\u8f7d\u6700\u65b0\u7684 GPG \u5bc6\u94a5\u5e76\u5bfc\u5165\u3002\u8fd9\u662f\u89e3\u51b3 GPG check FAILED \u7684\u6807\u51c6\u505a\u6cd5\uff0c\u591a\u4e2a\u6765\u6e90\u90fd\u786e\u8ba4\u6709\u6548\u3002\n\n&#91;root@localhost ~]# dnf clean packages\n# \u6e05\u6389\u521a\u624d\u4e0b\u8f7d\u5931\u8d25\u6b8b\u7559\u7684\u7f13\u5b58\u5305<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6572\u51fa\u8fd9\u4e9b\u547d\u4ee4\u4ee5\u89e3\u51b3\uff0c\u7136\u540e\u91cd\u65b0\u4e0b\u8f7d\u5c31\u884c\u4e86<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u7136\u540e\u6211\u4eec\u4e0b\u8f7d\u90a3\u56db\u4e2a\u8f6f\u4ef6<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# dnf install -y nginx mariadb-server php83-php-fpm php83-php-mysqlnd \\\n  php83-php-gd php83-php-mbstring php83-php-xml php83-php-zip \\\n  php83-php-intl php83-php-bcmath php83-php-curl php83-php-opcache<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5177\u4f53\u4f5c\u7528\u662f\u8fd9\u4e9b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>nginx<\/code>\u3001<code>mariadb-server<\/code>\u3001<code>php83-php-fpm<\/code>\u3001<code>php83-php-mysqlnd<\/code>\uff1a\u56db\u4e2a\u6838\u5fc3\uff0c\u5fc5\u987b\u6709\u3002<\/li>\n\n\n\n<li><code>php83-php-gd<\/code>\uff1a\u7f29\u7565\u56fe\u3001\u56fe\u7247\u5904\u7406\u3002<\/li>\n\n\n\n<li><code>php83-php-mbstring<\/code>\uff1a\u4e2d\u6587\u3001emoji \u4e0d\u4e71\u7801\u3002<\/li>\n\n\n\n<li><code>php83-php-xml<\/code>\uff1aRSS\u3001\u7ad9\u70b9\u5730\u56fe\u3002<\/li>\n\n\n\n<li><code>php83-php-zip<\/code>\uff1a\u540e\u53f0\u88c5\u4e3b\u9898\/\u63d2\u4ef6\u89e3\u538b\u3002<\/li>\n\n\n\n<li><code>php83-php-intl<\/code>\uff1a\u591a\u8bed\u8a00\u3002<\/li>\n\n\n\n<li><code>php83-php-bcmath<\/code>\uff1a\u91d1\u989d\u7b49\u9ad8\u7cbe\u5ea6\u8ba1\u7b97\u3002<\/li>\n\n\n\n<li><code>php83-php-curl<\/code>\uff1aWordPress \u66f4\u65b0\u3001\u8c03\u5916\u90e8 API\u3002<\/li>\n\n\n\n<li><code>php83-php-opcache<\/code>\uff1a\u7f13\u5b58\uff0c\u63d0\u901f\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5f00\u542f\u670d\u52a1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# systemctl enable --now nginx mariadb php83-php-fpm\n\n&#91;root@localhost ~]# ls \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock\n\/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock\n# PHP-FPM \u542f\u52a8\u540e\u4f1a\u5728 \/run\/php-fpm\/ \u4e0b\u521b\u5efa socket \u6587\u4ef6\uff08\u901a\u5e38\u53eb www.sock\uff09\u3002Nginx \u7684 fastcgi_pass \u5fc5\u987b\u6307\u5411\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4e0d\u8fc7\u5f88\u663e\u7136\uff0cPHP83\u7248\u672c\u672c\u6587\u4ef6\u7684\u8def\u5f84\u4e0d\u592a\u4e00\u6837<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u6570\u636e\u5e93<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u52a8\u6001\u7f51\u7ad9\u7684\u5185\u5bb9\u5b58\u5728\u6570\u636e\u5e93\u91cc\u3002WordPress \u8fd0\u884c\u65f6\u4e0d\u65ad\u4ece\u6570\u636e\u5e93\u8bfb\u6570\u636e\u3001\u5f80\u6570\u636e\u5e93\u5199\u6570\u636e\uff0c\u6240\u4ee5\u8981\u5148\u5efa\u597d\u5e93\u548c\u7528\u6237\uff0c\u7ed9 WordPress \u4e00\u4e2a\u80fd\u8fde\u5e93\u5b58\u6570\u636e\u7684\u5730\u65b9\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u521d\u59cb\u5316\u6570\u636e\u5e93\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# mysql_secure_installation\n# \u5bf9 MariaDB \u505a\u5b89\u5168\u521d\u59cb\u5316\uff1a\u8bbe root \u5bc6\u7801\u3001\u5220\u533f\u540d\u7528\u6237\u3001\u7981\u6b62 root \u8fdc\u7a0b\u767b\u5f55\u3001\u5220 test \u5e93\n\n&#91;root@localhost ~]# mysql -u root -p\n# \u7528\u521a\u8bbe\u7f6e\u7684root\u8d26\u6237\u8fdb\u5165 MariaDB\n\nMariaDB &#91;(none)]&gt; CREATE DATABASE wp DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\n\u5efa\u4e00\u4e2a\u53eb wp \u7684\u5e93\u3002WordPress \u7684\u6587\u7ae0\u3001\u7528\u6237\u3001\u8bc4\u8bba\u3001\u8bbe\u7f6e\u4ee5\u540e\u90fd\u5b58\u8fd9\u91cc\u3002\n\nMariaDB &#91;(none)]&gt; CREATE USER 'wpuser'@'localhost' IDENTIFIED BY '\u5bc6\u7801';\n\u5efa\u6570\u636e\u5e93\u7528\u6237 wpuser\u5e76\u4e14\u8bbe\u5bc6\u7801\u3002WordPress \u7528\u8fd9\u4e2a\u8eab\u4efd\u8fde\u5e93\uff0c\u4e0d\u7528 root\u3002\n\nMariaDB &#91;(none)]&gt; GRANT ALL PRIVILEGES ON wp.* TO 'wpuser'@'localhost';\n\u628a wp \u5e93\u7684\u5168\u90e8\u6743\u9650\u6388\u4e88 wpuser\u3002\u5f53\u7136\uff0c\u4e5f\u4ec5\u6b64wp\u5e93\u4e86\n\nMariaDB &#91;(none)]&gt; FLUSH PRIVILEGES;\n\u5237\u65b0\u6743\u9650\u8868\uff0c\u8ba9\u6388\u6743\u7acb\u5373\u751f\u6548<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u6ce8\u610f\uff1a\u5e93\u540d wp\u3001\u7528\u6237\u540d wpuser\u3001wpuser \u7684\u5bc6\u7801\u3002\u8fd9\u4e09\u6837\u8981\u8bb0\u4f4f\uff0c\u5b89\u88c5 WordPress \u65f6\u8981\u586b\u3002<\/p>\n<\/blockquote>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u540d\u5b57<\/th><th>\u662f\u4ec0\u4e48<\/th><th>\u6743\u9650<\/th><\/tr><\/thead><tbody><tr><td><code>root<\/code><\/td><td>MariaDB \u603b\u7ba1\u7406\u5458<\/td><td>\u6240\u6709\u5e93\uff0c\u5168\u90e8\u6743\u9650<\/td><\/tr><tr><td><code>wp<\/code><\/td><td>\u4e00\u4e2a\u5e93<\/td><td>\u5b58 WordPress \u6570\u636e<\/td><\/tr><tr><td><code>wpuser<\/code><\/td><td>\u4e00\u4e2a\u6570\u636e\u5e93\u7528\u6237<\/td><td>\u53ea\u6709 <code>wp<\/code> \u5e93\u7684\u6743\u9650<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e0b\u8f7d WordPress \u4ee3\u7801\uff0c\u653e\u5230\u7f51\u7ad9\u76ee\u5f55<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# cd \/tmp\/\n&#91;root@localhost tmp]# curl -O https:\/\/wordpress.org\/latest.tar.gz \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u4e0b\u8f7dWordPress\u7684\u538b\u7f29\u5305\n\n&#91;root@localhost tmp]# tar -xf latest.tar.gz -C \/var\/www \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u89e3\u538b\u5230\/var\/www\n\n&#91;root@localhost tmp]# chown -R nginx:nginx \/var\/www\/wordpress\/ \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u9012\u5f52\u4fee\u6539\u6587\u4ef6\u6240\u5c5e\u8005\u548c\u7ec4\uff0c\u8ba9nginx\u53ef\u4ee5\u81ea\u5df1\u7528\n\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u914d Nginx\uff0c\u628a PHP \u8bf7\u6c42\u8f6c\u7ed9 PHP-FPM<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>$uri<\/code>\uff1a\u5f53\u524d\u8bf7\u6c42\u7684\u8def\u5f84<\/li>\n\n\n\n<li><code>$args<\/code>\uff1aURL \u91cc <code>?<\/code> \u540e\u9762\u7684\u53c2\u6570<\/li>\n\n\n\n<li><code>$document_root<\/code>\uff1a\u5f53\u524d <code>root<\/code> \u6307\u4ee4\u7684\u503c<\/li>\n\n\n\n<li><code>$fastcgi_script_name<\/code>\uff1a\u8981\u6267\u884c\u7684\u811a\u672c\u8def\u5f84<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e9b\u540d\u5b57\u4e5f\u662f Nginx \u5b9a\u6b7b\u7684\uff0c\u62fc\u9519\u5c31\u53d6\u4e0d\u5230\u503c\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4ec0\u4e48\u662f\u8fd9\u51e0\u4e2a\u53c2\u6570\u3001\u8fd9\u4e2a\u987a\u5e8f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>try_files<\/code> \u7684\u8bed\u6cd5\u662f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try_files \u6587\u4ef61 \u6587\u4ef62 ... \u6700\u540e\u515c\u5e95;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u524d\u9762\u53ef\u4ee5\u5217\u4efb\u610f\u591a\u4e2a\u201c\u5c1d\u8bd5\u9879\u201d\uff0cNginx \u6309\u987a\u5e8f\u627e\u3002<\/li>\n\n\n\n<li><strong>\u6700\u540e\u4e00\u4e2a\u5fc5\u987b\u662f\u515c\u5e95<\/strong>\uff08\u5185\u90e8\u91cd\u5b9a\u5411\u6216\u8fd4\u56de\u7801\uff09\uff0c\u4e0d\u80fd\u4e5f\u662f\u6587\u4ef6\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5 <code>try_files $uri $uri\/ \/index.php?$args;<\/code> \u7684\u610f\u601d\u662f\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>$uri<\/code> \u2192 \u5148\u8bd5\u771f\u5b9e\u6587\u4ef6<\/li>\n\n\n\n<li><code>$uri\/<\/code> \u2192 \u518d\u8bd5\u76ee\u5f55<\/li>\n\n\n\n<li><code>\/index.php?$args<\/code> \u2192 \u6700\u540e\u515c\u5e95\uff0c\u8f6c\u7ed9 index.php<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost tmp]# vim \/etc\/nginx\/conf.d\/wordpress.conf\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\nserver{\n        listen 80;\n        server_name IP;\n        root \/var\/www\/wordpress;\n        index index.php index.html;\n        client_max_body_size 64M; \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014Nginx \u5141\u8bb8\u7684\u6700\u5927\u4e0a\u4f20\u5927\u5c0f 64M\u3002\u9ed8\u8ba4 1M\uff0c\u4f20\u4e3b\u9898\/\u56fe\u7247\u4f1a\u88ab\u62e6\uff0c\u6240\u4ee5\u8c03\u5927\u3002\n        location \/ { \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u7528\u6237\u8bbf\u95ee\u7684\u7f51\u5740\u4e0d\u4ee5 .php \u7ed3\u5c3e\u65f6\uff0c\u8d70\u8fd9\u91cc\n           try_files $uri $uri\/ \/index.php?$args;\n        }\n        location ~ \\.php$ { \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u7528\u6237\u8bbf\u95ee\u7684\u7f51\u5740\u4ee5 .php \u7ed3\u5c3e\u65f6\uff0c\u8d70\u8fd9\u91cc\n                include fastcgi_params;\n                fastcgi_pass unix:\/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock;\n                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        }\n        location ~ \/\\.(?!well-known) { \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u7528\u6237\u8bbf\u95ee\u4ee5 \/. \u5f00\u5934\u7684\u7f51\u5740\u65f6\uff0c\u8d70\u8fd9\u91cc\u3002\u6bd4\u5982 \/.git\/config\u3001\/.env\u3002deny all \u76f4\u63a5\u62d2\u7edd\uff0c\u8fd4\u56de 403\u3002\u8fd9\u4e9b\u662f\u9690\u85cf\u6587\u4ef6\uff0c\u53ef\u80fd\u542b\u5bc6\u7801\u6216\u6e90\u7801\u4fe1\u606f\uff0c\u4e0d\u80fd\u8ba9\u4eba\u4e0b\u8f7d\n                deny all;\n        }\n}\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# vim \/etc\/opt\/remi\/php83\/php-fpm.d\/www.conf \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u4fee\u6539php\u7684\u914d\u7f6e\u6587\u4ef6\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014 \n 24 user = nginx\n\n 26 group = nginx\n\n 48 listen.owner = nginx\n 49 listen.group = nginx\n 50 listen.mode = 0660\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014 \n\n&#91;root@localhost ~]# ls -l \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock \u2014\u2014\u2014\u2014\u2014\u53ef\u4ee5\u770b\u5230\u6587\u4ef6\u6240\u6709\u8005\u548c\u7ec4\u662froot\uff0cnginx\u6253\u4e0d\u5f00\nsrw-rw----+ 1 root root 0 Oct 27 09:15 \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock\n&#91;root@localhost ~]# chown nginx:nginx \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u4e34\u65f6\u4fee\u6539\u4e3anginx\n&#91;root@localhost ~]# ls -l \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock\nsrw-rw----+ 1 nginx nginx 0 Oct 27 09:15 \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock\n&#91;root@localhost ~]# mkdir -p \/etc\/systemd\/system\/php83-php-fpm.service.d\/ \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u8ba9 systemd \u4ee5\u540e\u6bcf\u6b21\u91cd\u542f PHP-FPM \u65f6\uff0c\u90fd\u81ea\u52a8\u628a\u6743\u9650\u7ed9 nginx\n&#91;root@localhost ~]# echo -e \"&#91;Service]\\nRuntimeDirectoryMode=0750\\nExecStartPost=\/bin\/chown nginx:nginx \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock\" &gt; \/etc\/systemd\/system\/php83-php-fpm.service.d\/override.conf \u2014\u2014\u2014\u2014\u5199\u4e00\u4e2a\u914d\u7f6e\u8ba9 systemd \u751f\u6548\n&#91;root@localhost ~]# systemctl daemon-reload \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u91cd\u65b0\u52a0\u8f7d systemd \u914d\u7f6e\u5e76\u91cd\u542f PHP-FPM\n&#91;root@localhost ~]# systemctl start php83-php-fpm\n&#91;root@localhost ~]# ls -l \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock\nsrw-rw----+ 1 nginx nginx 0 Oct 27 09:24 \/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock\n&#91;root@localhost ~]# systemctl restart nginx\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">WordPress \u5b89\u88c5\u5411\u5bfc<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6d4f\u89c8\u5668\u8f93\u5165\u4f60\u7684IP\u5730\u5740\uff0c\u7136\u540e\u4e00\u6b65\u4e00\u6b65\u8ddf\u7740\u5f15\u5bfc\u8d70\uff0c\u6700\u540e\u767b\u5f55<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u4ee5\u540e\u60f3\u5728\u5176\u4ed6\u7535\u8111\u4e0a\u767b\u5f55\u53ef\u4ee5\u5728IP\u5730\u5740\u540e\u52a0\u4e0a\/wp-admin<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/hjm259775-a11y\/image-hosting\/main\/test\/20261028140056994.png\" alt=\"image-20261028140049067\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u4f60\u770b\u5230\u8fd9\u4e2a\u754c\u9762\uff0c\u5c31\u4ee3\u8868\u88c5\u597d\u4e86<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fde\u63a5\u57df\u540d<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u662f\u901a\u8fc7\u670d\u52a1\u5668 IP\u8bbf\u95ee\u7f51\u7ad9\u7684\u3002\u4f46 IP \u96be\u8bb0\u3001\u4e0d\u5b89\u5168\uff08\u6d4f\u89c8\u5668\u63d0\u793a\u201c\u4e0d\u5b89\u5168\u201d\uff09\uff0c\u4e14\u65e0\u6cd5\u7533\u8bf7\u514d\u8d39\u8bc1\u4e66\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fde\u63a5\u57df\u540d\u53ef\u4ee5\u5b9e\u73b0\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u7528\u4e00\u4e2a\u597d\u8bb0\u7684\u540d\u5b57\u8bbf\u95ee\u7f51\u7ad9\u3002<\/li>\n\n\n\n<li>\u9690\u85cf\u670d\u52a1\u5668\u771f\u5b9e IP\uff0c\u9632\u6b62\u88ab\u653b\u51fb\u3002<\/li>\n\n\n\n<li>\u514d\u8d39\u83b7\u5f97 HTTPS \u52a0\u5bc6<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u521b\u5efa\u597d\u57df\u540d\u548c\u4f60URL\u7684\u5bf9\u5e94\u5173\u7cfb\u4e4b\u540e\uff0c\u4fee\u6539\/etc\/nginx\/conf.d\/wordpress.conf\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u539f\u672c\u7684IP\u6362\u6210\u4f60\u7684\u57df\u540d\uff0c\u5e76\u4e14\u4fee\u6539\u4f60\u6570\u636e\u5e93\u4e2d\u7684\u7f51\u5740<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p\nUSE wp;\nUPDATE wp_options SET option_value = 'http:\/\/\u7f51\u5740' WHERE option_name IN ('siteurl', 'home');\nEXIT;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u518d\u5bf9\/wp-admin\u8fdb\u884c\u8bbf\u95ee\uff0c\u5c31\u4f1a\u53d1\u73b0\u767b\u5f55\u754c\u9762\u53c8\u51fa\u6765\u4e86<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">https\u5efa\u7acb<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5148\u5728\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u514d\u8d39 SSL \u8bc1\u4e66<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u670d\u52a1\u5668\u662f AlmaLinux 8\uff0c\u53ef\u4ee5\u7528 Certbot \u4ece Let&#8217;s Encrypt \u7533\u8bf7\u514d\u8d39\u8bc1\u4e66\uff0c\u5b83\u4f1a\u81ea\u52a8\u5e2e\u4f60\u6539\u597d Nginx \u914d\u7f6e\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. \u5b89\u88c5 Certbot \u548c Nginx \u63d2\u4ef6<\/strong><br>\u5728\u670d\u52a1\u5668\u7ec8\u7aef\u8fd0\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf install -y epel-release\ndnf install -y certbot python3-certbot-nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. \u7533\u8bf7\u5e76\u81ea\u52a8\u914d\u7f6e\u8bc1\u4e66<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>certbot --nginx -d \u57df\u540d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fc7\u7a0b\u4e2d\u5b83\u4f1a\u95ee\u4f60\u90ae\u7bb1\u3001\u540c\u610f\u534f\u8bae\uff0c\u7136\u540e\u81ea\u52a8\u628a\u8bc1\u4e66\u88c5\u597d\u5e76\u4fee\u6539\u4f60\u7684 Nginx \u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. \u786e\u8ba4\u8bc1\u4e66\u88c5\u597d\u4e86<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls \/etc\/letsencrypt\/live\/\u57df\u540d\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4fee\u6539 Nginx \u914d\u7f6e\uff0c\u786e\u4fdd PHP \u6b63\u5e38<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Certbot \u4f1a\u81ea\u52a8\u6539\u4f60\u7684 <code>wordpress.conf<\/code>\uff0c\u4e4b\u540e\u9700\u8981\u624b\u52a8\u5728 <code>location ~ \\.php$<\/code> \u5757\u91cc\u52a0\u4e00\u884c\uff0c\u544a\u8bc9 PHP \u73b0\u5728\u786e\u5b9e\u662f HTTPS\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/nginx\/conf.d\/wordpress.conf\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\nserver{\n        server_name \u57df\u540d;\n        root \/var\/www\/wordpress;\n        index index.php index.html;\n        client_max_body_size 64M;\n        location \/ {\n           try_files $uri $uri\/ \/index.php?$args;\n        }\n        location ~ \\.php$ {\n                include fastcgi_params;\n                fastcgi_pass unix:\/var\/opt\/remi\/php83\/run\/php-fpm\/www.sock;\n                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n                fastcgi_param HTTPS on; \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u6dfb\u52a0\u8fd9\u9879\n        }\n        location ~ \/\\.(?!well-known) {\n                deny all;\n        }\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u52a0\u5b8c\u540e\u6d4b\u8bd5\u5e76\u91cd\u8f7d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx -t &amp;&amp; systemctl reload nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e4b\u540e\u628a Cloudflare \u6539\u6210\u201c\u5b8c\u5168\uff08\u4e25\u683c\uff09\u201d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u547d\u4ee4\u8865\u5168 \u521a\u4e70\u7684\u670d\u52a1\u5668\u6ca1\u6709\u8fd9\u9879\u529f\u80fd\uff0c\u6211\u4eec\u9700\u8981&hellip;<\/p>\n","protected":false},"author":1,"featured_media":122,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-6"],"_links":{"self":[{"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=34"}],"version-history":[{"count":4,"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":151,"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions\/151"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/media\/122"}],"wp:attachment":[{"href":"https:\/\/xgz.app\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}