{"id":28989,"date":"2022-11-20T15:21:55","date_gmt":"2023-11-30T04:16:13","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/"},"modified":"2025-08-12T11:10:15","modified_gmt":"2025-08-12T03:10:15","slug":"%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/","title":{"rendered":"\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09"},"content":{"rendered":"<p>\u5f53\u6211\u8bd5\u56fe\u5c06\u6a31\u82b1VPS\u7684\u8ba1\u5212\u4ece1GB\u5347\u7ea7\u52302GB\u65f6\uff0c\u53d1\u73b0\u6211\u5f53\u524d\u7684v3\u5957\u9910\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\uff0c\u6240\u4ee5\u6211\u4ece\u5934\u5f00\u59cb\u91cd\u65b0\u642d\u5efa\u4e86\u670d\u52a1\u5668\u3002\u6211\u4f1a\u5728\u4e0b\u9762\u4ee5\u5907\u5fd8\u5f55\u7684\u5f62\u5f0f\u8bb0\u5f55\u4e0b\u5f53\u65f6\u7684\u6b65\u9aa4\u3002<\/p>\n<blockquote><p>2019\/09\/29<br \/>\n\u6211\u5199\u4e86\u4e00\u7bc7\u5173\u4e8e\u642d\u5efa\u201cNginx+PHP7.1+MariaDB\u7684phpMyAdmin\u201d\u7684\u7eed\u96c6\u6587\u7ae0\u3002<\/p><\/blockquote>\n<p>\u5404\u79cd\u7248\u672c\u7b49\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">CentOS Linux release 7.2.1511 (Core)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">nginx version: nginx\/1.12.1<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">PHP 7.1.8 (cli) (built: Aug 2 2017 12:13:05) ( NTS )<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">mysql Ver 15.1 Distrib 10.2.7-MariaDB, for Linux (x86_64) using readline 5.1<\/ul>\n<p>\u4e0d\u7ba1\u600e\u6837\uff0c\u7b7e\u8ba2\u4e86v4\u76842GB\u5957\u9910\u5e76\u5f00\u59cb\u4f7f\u7528\u3002<br \/>\n\u53e6\u5916\uff0c\u5982\u679c\u547d\u4ee4\u7684\u5f00\u5934\u662f#\uff0c\u8868\u793a\u8d85\u7ea7\u7528\u6237\uff0c\u5982\u679c\u662f$\uff0c\u5219\u8868\u793a\u666e\u901a\u7528\u6237\uff08\u53ef\u4ee5\u4f7f\u7528sudo su root\u547d\u4ee4\uff09\u3002<\/p>\n<h1>\u91cd\u65b0\u5b89\u88c5\u64cd\u4f5c\u7cfb\u7edf\uff08CentOS7\uff09\u7531\u4e8eSakura VPS\u7684\u521d\u59cb\u64cd\u4f5c\u7cfb\u7edf\u662f\u201cCentOS 6\uff08x86_64\uff09\u201d\uff0c\u56e0\u6b64\u5c06\u5b89\u88c5\u201cCentOS 7 x86_64\u201d\u3002<\/p>\n<p>\u53ea\u9700\u5728\u63a7\u5236\u9762\u677f\u7684\u53f3\u4e0a\u89d2\u9009\u62e9\u201c\u5404\u79cd\u8bbe\u7f6e\u201d\uff0c\u7136\u540e\u9009\u62e9\u201c\u64cd\u4f5c\u7cfb\u7edf\u5b89\u88c5\u201d\uff0c\u5e76\u6309\u7167\u5c4f\u5e55\u4e0a\u7684\u6307\u793a\u8fdb\u884c\u64cd\u4f5c\u5373\u53ef\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cff4e37434c4406bc82cd\/8-0.png\" alt=\"0_os-reinstall.png\" \/>\u53ef\u4ee5\u9009\u62e9\u4f5c\u4e3a\u201c\u6807\u51c6\u64cd\u4f5c\u7cfb\u7edf\u201d\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cff4e37434c4406bc82cd\/10-0.png\" alt=\"2_select-os.png\" \/><\/p>\n<h1>\u6700\u521d\u7684\u8bbe\u7f6e\uff08\u5982\u5b89\u5168\u65b9\u9762\u7b49\uff09<\/p>\n<h2>\u767b\u5f55<\/p>\n<pre class=\"post-pre\"><code>$ ssh root@xx.xxx.xxx.xx\r\n<\/code><\/pre>\n<p>\u6216\u8005<\/p>\n<pre class=\"post-pre\"><code>$ ssh root@hoegehoge.com\r\n<\/code><\/pre>\n<h2>\u521b\u5efa\u7528\u6237\u6682\u65f6\u5148\u521b\u5efaadmin\u8d26\u53f7\u3002<\/p>\n<pre class=\"post-pre\"><code># useradd admin\r\n\r\n# passwd admin\r\nChanging password for user admin.\r\nNew password:\r\nRetype new password:\r\npasswd: all authentication tokens updated successfully.\r\n<\/code><\/pre>\n<p>\u7531\u4e8e\u6211\u60f3\u8981\u4f7f\u7528sudo\u547d\u4ee4\uff0c\u56e0\u6b64\u6211\u5c06\u6dfb\u52a0\u5230wheel\u7528\u6237\u7ec4\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code># id admin\r\nuid=1000(admin) gid=1000(admin) groups=1000(admin)\r\n\r\n# usermod -G wheel admin\r\n\r\n# id admin\r\nuid=1000(admin) gid=1000(admin) groups=1000(admin),10(wheel)\r\n<\/code><\/pre>\n<p>\u5728visudo\u4e2d\uff0c\u6709\u65f6\u5019\u53ef\u4ee5\u770b\u5230\u89e3\u9664\u6ce8\u91ca\u7684\u884c\u7684\u6b65\u9aa4\uff0c\u4f46\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5df2\u7ecf\u89e3\u9664\u6ce8\u91ca\u4e86\uff08\u53ef\u80fd\u662f\u65e0\u610f\u95f4\u89e3\u9664\u4e86\u6ce8\u91ca\uff0c\u6216\u8005\u662fCentOS7\u7684\u8bbe\u5b9a\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>## Allows people in group wheel to run all commands\r\n%wheel  ALL=(ALL)       ALL\r\n<\/code><\/pre>\n<h2>\u5728\u4e2d\u6587\u4e2d\uff0c\u5c06\u4ee5\u4e0b\u5185\u5bb9\u8fdb\u884c\u540c\u4e49\u8f6c\u8ff0\uff1a\u5207\u6362\u7528\u6237 -&gt; \u4f7f\u7528sudo\u547d\u4ee4\u5207\u6362\u5230root\u8eab\u4efd<\/p>\n<pre class=\"post-pre\"><code># exit\r\n\r\n$ ssh admin@xx.xxx.xxx.xx\r\n\r\n$ sudo su root\r\nWe trust you have received the usual lecture from the local System\r\nAdministrator. It usually boils down to these three things:\r\n\r\n    #1) Respect the privacy of others.\r\n    #2) Think before you type.\r\n    #3) With great power comes great responsibility.\r\n\r\n[sudo] password for admin:\r\n<\/code><\/pre>\n<h2>SSH\u7684\u914d\u7f6e\u8bbe\u7f6e\u6587\u4ef6\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code># vi \/etc\/ssh\/sshd_config\r\n<\/code><\/pre>\n<h3>\u7981\u6b62\u4f7f\u7528root\u7528\u6237\u767b\u5f55<\/p>\n<pre class=\"post-pre\"><code>#PermitRootLogin yes\r\nPermitRootLogin no\r\n<\/code><\/pre>\n<h3>\u7981\u6b62\u4f7f\u7528\u5bc6\u7801\u767b\u5f55<\/p>\n<pre class=\"post-pre\"><code>#PasswordAuthentication yes\r\nPasswordAuthentication no\r\n<\/code><\/pre>\n<p>\u53ea\u9700\u8981\u4e00\u4e2a\u9009\u62e9\uff1a<br \/>\n\u3010\u786e\u8ba4\u3011\u672a\u6ce8\u518c\u5bc6\u94a5\u6216\u8005authorized_keys\u7684\u6743\u9650\u4e0d\u4e3a600\u3002<\/p>\n<pre class=\"post-pre\"><code>$ ssh admin@xx.xxx.xxx.xx\r\nPermission denied (publickey).\r\n<\/code><\/pre>\n<h3>\u66f4\u6539\u9ed8\u8ba4\u7aef\u53e3<\/p>\n<pre class=\"post-pre\"><code>#Port 22\r\nPort 10022\r\n<\/code><\/pre>\n<p>\u3010\u786e\u8ba4\u3011\u9ed8\u8ba4\u7aef\u53e3\uff0822\uff09\u5c06\u88ab\u62d2\u7edd\u8bbf\u95ee<\/p>\n<pre class=\"post-pre\"><code>$ ssh admin@xx.xxx.xxx.xx\r\nssh: connect to host xx.xxx.xxx.xx port 22: Connection refused\r\n\r\n$ ssh admin@xx.xxx.xxx.xx -p 10022\r\n<\/code><\/pre>\n<h3>\u91cd\u65b0\u542f\u52a8SSH\u8bf7\u6ce8\u610f\u4e0d\u8981\u9000\u51fa\uff0c\u56e0\u4e3a\u66f4\u6539\u8bbe\u7f6e\u6587\u4ef6\u5e76\u91cd\u65b0\u542f\u52a8\u5c06\u5bfc\u81f4\u66f4\u6539\u751f\u6548\uff01\uff08\u4e0d\u4ec5\u4f1a\u5bfc\u81f4\u65e0\u6cd5\u8fdb\u884c\u5bc6\u7801\u767b\u5f55\u548c22\u53f7\u7aef\u53e3\u767b\u5f55\uff0c\u8fd8\u56e0\u4e3a10022\u53f7\u7aef\u53e3\u672a\u5f00\u653e\uff01\uff09<\/p>\n<pre class=\"post-pre\"><code># systemctl restart sshd.service\r\n<\/code><\/pre>\n<h2>\u516c\u958b\u5bc6\u94a5\u8ba4\u8bc1\u63d0\u524d\u5236\u4f5c\u516c\u94a5\u53ef\u80fd\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002<\/p>\n<h3>\u82f9\u679c\u672c\u5730<\/p>\n<pre class=\"post-pre\"><code>\/\/ \u9375\u304c\u306a\u3044\u5834\u5408\r\n$ ssh-keygen -t rsa\r\n\r\n$ cat .ssh\/id_rsa.pub\r\nssh-rsa .......\r\n<\/code><\/pre>\n<h3>\u670d\u52a1\u5668<\/p>\n<pre class=\"post-pre\"><code>$ mkdir ~\/.ssh\r\n$ chmod 700 .ssh\r\n$ cd .ssh\/\r\n$ vi authorized_keys\r\n\r\n\/\/ \u30ed\u30fc\u30ab\u30eb\u306e\u516c\u958b\u9375\u3092\u8cbc\u308a\u4ed8\u3051\u308b\uff08FTP\u3068\u304b\u3067\u9001\u3063\u305f\u307b\u3046\u304c\u6b63\u78ba\u3060\u3051\u3069\uff09\r\nssh-rsa .......\r\n\r\n$ chmod 600 authorized_keys\r\n<\/code><\/pre>\n<h2>\u4ee5sudo\u7528\u6237\u8eab\u4efd\u7ee7\u627fPATH\u3002\u7531\u4e8e\u7ba1\u7406\u5458\u7684$PATH\u548csudo su root\u65f6\u7684$PATH\u4e0d\u5339\u914d\u4f1a\u5f88\u9ebb\u70e6\uff0c\u6240\u4ee5\u6211\u4eec\u8981\u8fdb\u884c\u8c03\u6574\u3002<\/p>\n<pre class=\"post-pre\"><code>$ echo $PATH\r\n\/usr\/local\/bin:\/usr\/bin:\/usr\/local\/sbin:\/usr\/sbin:\/home\/admin\/.local\/bin:\/home\/admin\/bin\r\n\r\n$ sudo su root\r\n# echo $PATH\r\n\/sbin:\/bin:\/usr\/sbin:\/usr\/bin\r\n\r\n# exit\r\n\r\n$ sudo visudo\r\n---\r\nDefaults    env_reset\r\nDefaults    env_keep =  \"COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS\"\r\nDefaults    env_keep += \"MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE\"\r\nDefaults    env_keep += \"LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES\"\r\nDefaults    env_keep += \"LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE\"\r\nDefaults    env_keep += \"LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY\"\r\nDefaults    env_keep += \"PATH\" &lt;-\u8ffd\u52a0\r\n\r\n\/\/ \u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\n#Defaults    secure_path = \/sbin:\/bin:\/usr\/sbin:\/usr\/bin\r\n---\r\n\r\n\/\/ \u78ba\u8a8d\r\n$ sudo su root\r\n# echo $PATH\r\n\/usr\/local\/bin:\/usr\/bin:\/usr\/local\/sbin:\/usr\/sbin:\/home\/admin\/.local\/bin:\/home\/admin\/bin\r\n<\/code><\/pre>\n<p>\u53c2\u8003\u6765\u6e90\uff1a\u5728\u4f7f\u7528sudo\u7684\u540c\u65f6\u7ee7\u627f\u8def\u5f84 &#8211; \u968f\u5fc3\u6240\u6b32\u5730\u559d\u9152\u548c\u7761\u89c9\u3002<\/p>\n<h2>\u9632\u706b\u5899\u8bbe\u7f6e<br \/>\n\u7531\u4e8e\u9009\u62e9\u4e86CentOS7\uff0c\u6240\u4ee5\u6211\u51b3\u5b9a\u5c1d\u8bd5\u4f7f\u7528\u9632\u706b\u5899\u800c\u4e0d\u662f\u5927\u5bb6\u719f\u6089\u7684iptables\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ssh\u306e\u30dd\u30fc\u30c8\u309222\u304b\u308910022\u3068\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>http(80)\u3068https(443)\u3092\u8a31\u53ef\u3059\u308b<\/p>\n<pre class=\"post-pre\"><code># cp \/usr\/lib\/firewalld\/services\/ssh.xml \/etc\/firewalld\/services\/.\r\n# vi \/etc\/firewalld\/services\/ssh.xml\r\n---\r\n&lt;port protocol=\"tcp\" port=\"22\"\/&gt;\r\n                            \u25bc                             \r\n&lt;port protocol=\"tcp\" port=\"10022\"\/&gt;\r\n---\r\n\r\n# firewall-cmd --permanent --zone=public --add-service=http \r\n# firewall-cmd --permanent --zone=public --add-service=https\r\n# firewall-cmd --reload\r\nsuccess\r\n\r\n\/\/ \u78ba\u8a8d\r\n# firewall-cmd --list-all\r\npublic (default, active)\r\n  interfaces: eth0\r\n  sources:\r\n  services: dhcpv6-client http https ssh\r\n  ports:\r\n  masquerade: no\r\n  forward-ports:\r\n  icmp-blocks:\r\n  rich rules:\r\n<\/code><\/pre>\n<p>\u53c2\u8003: \u5165\u95e8CentOS7\u7684firewalld\u4f7f\u7528\u6307\u5357\uff08\u9644\u5e26\u4e9b\u8bb8systemd\uff09 &#8211; Qiita<\/p>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u64cd\u4f5c\u7cfb\u7edf\uff08CentOS7\uff09\u7684\u5b89\u88c5\u548c\u5b89\u5168\u76f8\u5173\u7684\u521d\u59cb\u8bbe\u7f6e\u5df2\u7ecf\u5b8c\u6210\u3002<\/p>\n<hr \/>\n<h1>\u51c6\u5907 \u7f51\u7edc\u670d\u52a1\u5668\u3001PHP \u548c\u6570\u636e\u5e93\u3002<\/p>\n<h2>Nginx\uff1a\u8fd9\u6b21\u6211\u4eec\u9009\u62e9\u4e86Nginx\u4f5c\u4e3aWeb\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u662fApache\u3002\uff08\u8fd9\u662f\u6211\u4eec\u7684\u7b2c\u4e00\u6b21\u5c1d\u8bd5\uff09<\/p>\n<h3>\u6dfb\u52a0\u5b58\u50a8\u5e93\u6839\u636e\u4ee5\u4e0b\u6b65\u9aa4\uff0c\u53c2\u8003 Linux packages \u7684\u7a33\u5b9a\u7248\u672c\u7684\u9884\u6784\u5efa\u8f6f\u4ef6\u5305\uff0c\u6dfb\u52a0\u4ed3\u5e93\u3002<br \/>\nnginx: Linux packages \u7684\u7a33\u5b9a\u7248\u672c\u7684\u9884\u6784\u5efa\u8f6f\u4ef6\u5305\u63d0\u4f9b\u4e86\u4e0b\u8ff0\u65b9\u6cd5\u6765\u6dfb\u52a0\u4ed3\u5e93\u3002<\/p>\n<pre class=\"post-pre\"><code># vi \/etc\/yum.repos.d\/nginx.repo\r\n---\r\n[nginx]\r\nname=nginx repo\r\nbaseurl=http:\/\/nginx.org\/packages\/centos\/7\/$basearch\/\r\ngpgcheck=0\r\nenabled=1\r\n---\r\n<\/code><\/pre>\n<h3>\u5b89\u88c5\u548c\u8bbe\u7f6e\u7f16\u8f91\/etc\/nginx\/conf.d\/default.conf\u6587\u4ef6\u8fdb\u884c\u914d\u7f6e\u3002\u5904\u4e8e\u6ce8\u91ca\u72b6\u6001\u7684\u90e8\u5206\u662f\u521d\u59cb\u8bbe\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code># yum -y install nginx\r\nComplete!\r\n\r\n# vi \/etc\/nginx\/conf.d\/default.conf\r\nserver {\r\n    root \/var\/www\/html;\r\n\r\n    location \/ {\r\n        #root   \/usr\/share\/nginx\/html;\r\n        root \/var\/www\/html;\r\n        #index  index.html index.htm;\r\n        index  index.php index.html index.htm;\r\n    }\r\n\r\n    # proxy from nginx to php-fpm\r\n    location ~ \\.php$ {\r\n        fastcgi_pass  localhost:9000;\r\n        fastcgi_param SCRIPT_FILENAME $document_root\/$fastcgi_script_name;\r\n        include       fastcgi_params;\r\n    }\r\n}\r\n<\/code><\/pre>\n<h3>\u542f\u52a8\u548c\u81ea\u52a8\u542f\u52a8\u8bbe\u7f6e<\/p>\n<pre class=\"post-pre\"><code># nginx -t\r\n# systemctl start nginx\r\n# systemctl enable nginx\r\n<\/code><\/pre>\n<h3>\u6587\u4ef6\u6839\u76ee\u9304\u6e96\u5099\u5b8c\u6210\u5c06admin\u7528\u6237\u6dfb\u52a0\u5230nginx\u7ec4\u4e2d\u3002\uff08\u5982\u679c\u6ca1\u6709-a\u9009\u9879\uff0c\u4f1a\u8986\u76d6\u5e76\u5220\u9664wheel\u7ec4\uff09<\/p>\n<pre class=\"post-pre\"><code>$ sudo usermod -aG nginx admin\r\n$ exit\r\n\r\n\/\/ \u518d\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u78ba\u8a8d\r\n$ id\r\nuid=1000(admin) gid=1000(admin) groups=1000(admin),10(wheel),990(nginx)\r\n<\/code><\/pre>\n<p>\u5c06\u6587\u6863\u6839\u76ee\u5f55\u7684\u6743\u9650\u8bbe\u7f6e\u4e3anginx\u3002\u5e76\u4e14\u914d\u7f6e\u4e3a\u4ee5\u540e\u521b\u5efa\u7684\u6587\u4ef6\u4e5f\u5177\u6709\u76f8\u540c\u7684\u6743\u9650\uff082770\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>$ sudo chown -R nginx:nginx \/var\/www\/html\r\n$ sudo chmod -R 2770 \/var\/www\/html\r\n\r\n$ ls -lrth\r\ndrwxrws--- 2 nginx nginx 6 Apr 13 06:04 html\r\n<\/code><\/pre>\n<h2>PHP7.1\u7531\u4e8e\u6807\u51c6\u7684yum\u5b89\u88c5\u7684PHP\u7248\u672c\u8f83\u65e7\uff08\u59825.6\uff09\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u6dfb\u52a0EPEL\/Remi\u4ed3\u5e93\u6765\u5b89\u88c5PHP7.1\u3002<\/p>\n<h3>\u6dfb\u52a0\u5b58\u50a8\u5e93<\/p>\n<pre class=\"post-pre\"><code>\/\/ EPEL\u30ea\u30dd\u30b8\u30c8\u30ea\r\n# yum -y install epel-release\r\nComplete!\r\n\r\n\/\/ Remi\u30ea\u30dd\u30b8\u30c8\u30ea\r\n# rpm -Uvh http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-7.rpm\r\nUpdating \/ installing...\r\n   1:remi-release-7.3-2.el7.remi      ################################# [100%]\r\n<\/code><\/pre>\n<h3>\u5b89\u88c5\u548c\u8bbe\u7f6e\u7f16\u8f91\/etc\/php.ini\u6587\u4ef6\u6765\u8fdb\u884c\u8bbe\u7f6e\u3002\u88ab\u6ce8\u91ca\u6389\u7684\u90e8\u5206\u662f\u9ed8\u8ba4\u72b6\u6001\u3002<\/p>\n<pre class=\"post-pre\"><code>\/\/ PHP7.1\uff08php-*\u306f\u4f7f\u3044\u305d\u3046\u306a\u3082\u306e\u3092\u9069\u5f53\u306b\u5165\u308c\u3066\u307e\u3059\u3002\u4f46\u3057\u3001php-fpm\u306fnginx\u3068\u306e\u9023\u643a\u3067\u5fc5\u9808\uff01\uff09\r\n# yum -y install --enablerepo=remi-php71 php php-cli php-common php-devel php-fpm php-gd php-mbstring php-mysqlnd php-pdo php-pear php-pecl-apcu php-soap php-xml php-xmlrpc\r\nComplete!\r\n\r\n# php -v\r\nPHP 7.1.8 (cli) (built: Aug  2 2017 10:45:15) ( NTS )\r\nCopyright (c) 1997-2017 The PHP Group\r\nZend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies\r\n\r\n# vi \/etc\/php.ini\r\n---\r\n;date.timezone =\r\ndate.timezone = \"Asia\/Tokyo\"\r\n\r\n;expose_php = On\r\nexpose_php = Off\r\n\r\n;mbstring.language = Japanese\r\nmbstring.language = Japanese\r\n\r\n;mbstring.internal_encoding =\r\nmbstring.internal_encoding = UTF-8\r\n\r\n;mbstring.http_input =\r\nmbstring.http_input = auto\r\n---\r\n<\/code><\/pre>\n<h3>PHP-FPM\u7684\u914d\u7f6e\u6211\u8981\u7f16\u8f91\u4e0ePHP7.1\u4e00\u8d77\u5b89\u88c5\u7684PHP-FPM\u914d\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code># vi \/etc\/php-fpm.d\/www.conf\r\n---\r\n;user = apache\r\nuser = nginx\r\n\r\n;group = apache\r\ngroup = nginx\r\n---\r\n<\/code><\/pre>\n<h3>\u542f\u52a8\u548c\u81ea\u52a8\u542f\u52a8\u8bbe\u7f6e<\/p>\n<pre class=\"post-pre\"><code># php-fpm -t\r\n[16-Aug-2017 18:15:04] NOTICE: configuration file \/etc\/php-fpm.conf test is successful\r\n\r\n# systemctl start php-fpm\r\n# systemctl enable php-fpm\r\n<\/code><\/pre>\n<h3>\u786e\u8ba4\u5982\u679cphpinfo()\u5728\u6587\u6863\u6839\u76ee\u5f55\u4e2d\u80fd\u591f\u6b63\u5e38\u663e\u793a\uff0c\u5219\u8868\u793a\u6210\u529f\u3002<\/p>\n<pre class=\"post-pre\"><code>$ cd \/var\/www\/html\r\n$ vi index.php\r\n---\r\n&lt;?php\r\nphpinfo();\r\n?&gt;\r\n---\r\n\r\n$ rm index.php\r\n<\/code><\/pre>\n<h2>\u739b\u4e3d\u4e9a\u6570\u636e\u5e93\u4e0ePHP\u4e00\u6837\uff0c\u5982\u679c\u5728\u6807\u51c6\u7684yum\u4e2d\u5b89\u88c5\uff0c\u7248\u672c\u4f3c\u4e4e\u8f83\u65e7\uff0c\u6240\u4ee5\u9700\u8981\u6dfb\u52a0\u5b58\u50a8\u5e93\u3002<\/p>\n<h3>\u6dfb\u52a0\u5b58\u50a8\u5e93<\/p>\n<pre class=\"post-pre\"><code># vi \/etc\/yum.repos.d\/MariaDB.repo\r\n---\r\n# MariaDB 10.2 CentOS repository list - created 2017-08-15 04:25 UTC\r\n# http:\/\/downloads.mariadb.org\/mariadb\/repositories\/\r\n[mariadb]\r\nname = MariaDB\r\nbaseurl = http:\/\/yum.mariadb.org\/10.2\/centos7-amd64\r\ngpgkey=https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB\r\ngpgcheck=1\r\n---\r\n<\/code><\/pre>\n<h3>\u5b89\u88c5<\/p>\n<pre class=\"post-pre\"><code># yum -y install MariaDB-server MariaDB-client\r\nComplete!\r\n\r\n# mysql -V\r\nmysql  Ver 15.1 Distrib 10.2.7-MariaDB, for Linux (x86_64) using readline 5.1\r\n<\/code><\/pre>\n<h3>\u542f\u52a8\u548c\u81ea\u52a8\u542f\u52a8\u8bbe\u7f6e<\/p>\n<pre class=\"post-pre\"><code># systemctl start mariadb\r\n# systemctl enable mariadb\r\n<\/code><\/pre>\n<p>\u5728CentOS7\u4e0a\u5b89\u88c5PHP7.1\u3001h2o\u3001MariaDB10.1\u548cWord Press\u7684\u53c2\u8003\u3002<br \/>\n\u53c2\u8003\uff1aMariaDB &#8211; \u8bbe\u7f6eMariaDB\u6e90 &#8211; MariaDB\u3002<\/p>\n<h3>\u6700\u521d\u7684\u8bbe\u5b9a<br \/>\n\u4f3c\u4e4e\u53ea\u8981\u7528&#8221;\u662f&#8221;\u56de\u7b54\u6240\u6709\u57fa\u672c\u95ee\u9898\uff0c\u5b83\u4f1a\u4ee5\u4ee4\u4eba\u6ee1\u610f\u7684\u65b9\u5f0f\u5e2e\u52a9\u89e3\u51b3\u3002<\/p>\n<pre class=\"post-pre\"><code># mysql_secure_installation\r\n\r\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB\r\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\r\n\r\nIn order to log into MariaDB to secure it, we'll need the current\r\npassword for the root user.  If you've just installed MariaDB, and\r\nyou haven't set the root password yet, the password will be blank,\r\nso you should just press enter here.\r\n\r\nEnter current password for root (enter for none):\r\nOK, successfully used password, moving on...\r\n\r\nSetting the root password ensures that nobody can log into the MariaDB\r\nroot user without the proper authorisation.\r\n\r\nSet root password? [Y\/n] Y\r\nNew password:\r\nRe-enter new password:\r\nPassword updated successfully!\r\nReloading privilege tables..\r\n ... Success!\r\n\r\n\r\nBy default, a MariaDB installation has an anonymous user, allowing anyone\r\nto log into MariaDB without having to have a user account created for\r\nthem.  This is intended only for testing, and to make the installation\r\ngo a bit smoother.  You should remove them before moving into a\r\nproduction environment.\r\n\r\nRemove anonymous users? [Y\/n] Y\r\n ... Success!\r\n\r\nNormally, root should only be allowed to connect from 'localhost'.  This\r\nensures that someone cannot guess at the root password from the network.\r\n\r\nDisallow root login remotely? [Y\/n] Y\r\n ... Success!\r\n\r\nBy default, MariaDB comes with a database named 'test' that anyone can\r\naccess.  This is also intended only for testing, and should be removed\r\nbefore moving into a production environment.\r\n\r\nRemove test database and access to it? [Y\/n] Y\r\n - Dropping test database...\r\n ... Success!\r\n - Removing privileges on test database...\r\n ... Success!\r\n\r\nReloading the privilege tables will ensure that all changes made so far\r\nwill take effect immediately.\r\n\r\nReload privilege tables now? [Y\/n] Y\r\n ... Success!\r\n\r\nCleaning up...\r\n\r\nAll done!  If you've completed all of the above steps, your MariaDB\r\ninstallation should now be secure.\r\n\r\nThanks for using MariaDB!\r\n<\/code><\/pre>\n<h3>\u6587\u672c\u7f16\u7801\u8bbe\u7f6e<\/p>\n<pre class=\"post-pre\"><code># vi \/etc\/my.cnf.d\/server.cnf\r\n---\r\n[mysqld]\r\ncharacter-set-server = utf8\r\n---\r\n<\/code><\/pre>\n<h3>\u91cd\u542f<\/p>\n<pre class=\"post-pre\"><code># systemctl restart mariadb\r\n<\/code><\/pre>\n<h2>\u521b\u5efaDB\u64cd\u4f5c\u7528\u6237\u5e76\u6388\u4e88\u6743\u9650\u3002\u5728WordPress\u4e2d\u521b\u5efa\u4e00\u4e2a\u7a7a\u7684\u6570\u636e\u5e93\uff0c\u5e76\u6388\u4e88\u7ba1\u7406\u5458\u7528\u6237\u6743\u9650\uff08\u5e76\u8bbe\u7f6e\u5bc6\u7801\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code># mysql -p\r\nEnter password:\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 17\r\nServer version: 10.2.7-MariaDB MariaDB Server\r\n\r\nMariaDB [(none)]&gt; create database [DB Name];\r\nQuery OK, 1 row affected (0.00 sec)\r\n\r\nMariaDB [(none)]&gt; grant all privileges on [DB Name].* to admin@localhost identified by '[Your Password]';\r\nQuery OK, 0 rows affected (0.00 sec)\r\n\r\n\/\/ \u5fc5\u8981\u306a\u3089\uff08\u53cd\u6620?\uff09\r\nMariaDB [(none)]&gt; FLUSH PRIVILEGES;\r\nQuery OK, 0 rows affected (0.00 sec)\r\n\r\nMariaDB [(none)]&gt; quit;\r\nBye\r\n<\/code><\/pre>\n<h1>\u51c6\u5907WordPress<\/p>\n<h2>\u5b89\u88c5WordPress<\/p>\n<h3>\u4ece\u516c\u5f0f\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7684WordPress<\/p>\n<pre class=\"post-pre\"><code>$ cd \/var\/www\/html\r\n$ wget http:\/\/ja.wordpress.org\/latest-ja.tar.gz\r\n--2017-08-15 14:09:10--  http:\/\/ja.wordpress.org\/latest-ja.tar.gz\r\nResolving ja.wordpress.org (ja.wordpress.org)... 66.155.40.250, 66.155.40.249\r\nConnecting to ja.wordpress.org (ja.wordpress.org)|66.155.40.250|:80... connected.\r\nHTTP request sent, awaiting response... 301 Moved Permanently\r\nLocation: https:\/\/ja.wordpress.org\/latest-ja.tar.gz [following]\r\n--2017-08-15 14:09:10--  https:\/\/ja.wordpress.org\/latest-ja.tar.gz\r\nConnecting to ja.wordpress.org (ja.wordpress.org)|66.155.40.250|:443... connected.\r\nHTTP request sent, awaiting response... 200 OK\r\nLength: 8652714 (8.3M) [application\/octet-stream]\r\nSaving to: 'latest-ja.tar.gz'\r\n\r\n100%[========================================================&gt;] 8,652,714   3.16MB\/s   in 2.6s\r\n\r\n2017-08-15 14:09:13 (3.16 MB\/s) - 'latest-ja.tar.gz' saved [8652714\/8652714]\r\n<\/code><\/pre>\n<h3>\u89e3\u51bb\u00b7\u6743\u9650\u66f4\u6539\u4f7f\u5f97\u53ef\u4ee5\u5728\u6587\u6863\u6839\u76ee\u5f55\u76f4\u63a5\u901a\u8fc7wp\u8def\u5f84\u8fdb\u884c\u8bbf\u95ee\u3002<\/p>\n<pre class=\"post-pre\"><code>$ tar xzvf latest-ja.tar.gz\r\n$ mv wordpress wp\r\n$ sudo find \/var\/www\/html -type d -exec chmod 770 {} \\;  \r\n$ sudo find \/var\/www\/html -type f -exec chmod 660 {} \\; \r\n<\/code><\/pre>\n<h3>\u6700\u521d\u7684\u914d\u7f6e\u5f53\u5728http:\/\/xx.xxx.xxx.xx\/wp\u4e0a\u8bbf\u95ee\u65f6\uff0c\u5c06\u5f00\u59cb\u8fdb\u884c\u521d\u59cb\u8bbe\u7f6e\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cff4e37434c4406bc82cd\/117-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2017-08-15 16.12.51.png\" \/><\/p>\n<h3>\u589e\u52a0\u8bbe\u7f6e\uff08\u5efa\u8bae\uff09<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">plugin\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306a\u3069\u3092FTP\u4e0d\u8981\u3068\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">wp-config\u306e\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u8a2d\u5b9a<\/ul>\n<pre class=\"post-pre\"><code>$ cd \/var\/www\/html\/wp\r\n\r\n$ sudo vi wp-config.php\r\n---\r\ndefine('FS_METHOD', 'direct');\r\n---\r\n\r\n$ sudo chmod 400 wp-config.php\r\n$ ls -l\r\n-r--------  1 nginx nginx 4.1K Aug 16 13:05 wp-config.php\r\n<\/code><\/pre>\n<h2>\u968f\u7740\u6c38\u4e45\u94fe\u63a5\u7684\u66f4\u6539\uff0c\u9700\u8981\u4fee\u6539Nginx\u7684\u914d\u7f6e\u3002\u8fd9\u6b21\u6211\u4eec\u5c06\u4f7f\u5f97\u53ef\u4ee5\u901a\u8fc7xx.xxx.xxx.xx\/wp\/YYYY\/MM\/DD\/PostTitle\u8fd9\u4e2aURL\u8fdb\u884c\u8bbf\u95ee\u3002<\/p>\n<h3>WordPress\u7684\u6c38\u4e45\u94fe\u63a5\u8bbe\u7f6e<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cff4e37434c4406bc82cd\/124-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2017-08-22 19.04.08.png\" \/><\/p>\n<h3>Nginx\u7684\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre class=\"post-pre\"><code>server {\r\n    listen       80;\r\n    server_name  xx.xxx.xxx.xx;\r\n    root         \/var\/www\/html;\r\n    index  index.php index.html index.htm;\r\n\r\n    charset utf-8;\r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ @wordpress;\r\n    }\r\n\r\n    # proxy from nginx to php-fpm\r\n    location ~ \\.php$ {\r\n        try_files $uri @wordpress;\r\n        fastcgi_index index.php;\r\n        fastcgi_split_path_info ^(.+\\.php)(.*)$;\r\n        fastcgi_pass  127.0.0.1:9000;\r\n        fastcgi_param SCRIPT_FILENAME $document_root\/$fastcgi_script_name;\r\n        include       fastcgi_params;\r\n    }\r\n    location @wordpress {\r\n        fastcgi_index index.php;\r\n        fastcgi_split_path_info ^(.+\\.php)(.*)$;\r\n        fastcgi_pass  127.0.0.1:9000;\r\n        fastcgi_param SCRIPT_FILENAME  $document_root\/wp\/index.php;\r\n        include       fastcgi_params;\r\n    }\r\n}\r\n<\/code><\/pre>\n<h1>\u8ba9\u6211\u4eec\u4f7f\u7528Let\u2019s Encrypt\u6765\u652f\u6301HTTPS\u6211\u4eec\u5c06\u4f7f\u7528Let&#8217;s encrypt\u514d\u8d39\u63d0\u4f9b\u7684\u8bc1\u4e66\u6765\u5b9e\u73b0HTTPS\u652f\u6301\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u5728\u6b64\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5Git\uff0c\u56e0\u4e3a\u5b83\u662f\u5fc5\u9700\u7684\u3002\uff08\u987a\u4fbf\u4ece\u6e90\u4ee3\u7801\u5b89\u88c5\uff09<\/p>\n<h2>\u5b89\u88c5Git<\/p>\n<pre class=\"post-pre\"><code># yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker\r\nComplete!\r\n\r\n# cd \/usr\/local\/src\r\n# wget https:\/\/www.kernel.org\/pub\/software\/scm\/git\/git-2.14.1.tar.gz\r\n[sudo] password for admin:\r\n--2017-08-15 16:20:12--  https:\/\/www.kernel.org\/pub\/software\/scm\/git\/git-2.14.1.tar.gz\r\n\r\n# ls -l\r\n-rw-r--r-- 1 root root 6987933 Aug 11 02:57 git-2.14.1.tar.gz\r\n\r\n# tar xzvf git-2.14.1.tar.gz\r\n# cd git-2.14.1\/\r\n# make prefix=\/usr\/local all\r\n# make prefix=\/usr\/local install\r\n\r\n\/\/ \u78ba\u8a8d\uff08root\uff08\u307e\u305f\u306fPATH\u304c\u901a\u3063\u3066\u3044\u306a\u3044\u5834\u5408\uff09\u3060\u3068git version 1.8.3.1\u3068\u306a\u308b?\uff09\r\n# exit\r\n$ git --version\r\ngit version 2.14.1 \r\n<\/code><\/pre>\n<h2>\u7ec8\u4e8e\u8ba9\u6211\u4eec\u5f00\u59cb\u52a0\u5bc6<\/p>\n<h3>\u53d1\u884c\u8bc1\u4e66<\/p>\n<pre class=\"post-pre\"><code>$ cd \/usr\/local\/\r\n$ sudo git clone https:\/\/github.com\/certbot\/certbot\r\n[sudo] password for admin:\r\nCloning into 'certbot'...\r\nremote: Counting objects: 48175, done.\r\nremote: Compressing objects: 100% (33\/33), done.\r\nremote: Total 48175 (delta 13), reused 17 (delta 7), pack-reused 48135\r\nReceiving objects: 100% (48175\/48175), 14.77 MiB | 3.76 MiB\/s, done.\r\nResolving deltas: 100% (34465\/34465), done.\r\n\r\n$ cd certbot\/\r\n$ .\/certbot-auto certonly --webroot --agree-tos -w \/var\/www\/html -m hogehoge@mail.com -d hogehoge.com\r\n<\/code><\/pre>\n<h3>\u786e\u8ba4\u8bc1\u4e66<\/p>\n<pre class=\"post-pre\"><code>$ sudo ls -lrth \/etc\/letsencrypt\/live\/hogehoge.com\r\nlrwxrwxrwx 1 root root  41 Aug 16 16:53 privkey.pem -&gt; ..\/..\/archive\/hogehoge\/privkey1.pem\r\nlrwxrwxrwx 1 root root  43 Aug 16 16:53 fullchain.pem -&gt; ..\/..\/archive\/hogehoge\/fullchain1.pem\r\nlrwxrwxrwx 1 root root  39 Aug 16 16:53 chain.pem -&gt; ..\/..\/archive\/hogehoge\/chain1.pem\r\nlrwxrwxrwx 1 root root  38 Aug 16 16:53 cert.pem -&gt; ..\/..\/archive\/hogehoge\/cert1.pem\r\n-rw-r--r-- 1 root root 543 Aug 16 16:53 README\r\n<\/code><\/pre>\n<h3>\u968f\u7740\u5bf9HTTPS\u7684\u652f\u6301\uff0c\u9700\u8981\u66f4\u6539Nginx\u7684\u8bbe\u7f6e\u3002\u5c06\u5bf9\u7aef\u53e380\u7684HTTP\u8bbf\u95ee\u91cd\u5b9a\u5411\u5230\u7aef\u53e3443\u7684HTTPS\u3002<\/p>\n<pre class=\"post-pre\"><code>server {\r\n    listen      80;\r\n    server_name hogehoge;\r\n    return      301 https:\/\/$host$request_uri;\r\n}\r\nserver {\r\n    listen      443 ssl;\r\n    server_name hogehoge;\r\n    root        \/var\/www\/html;\r\n    index       index.php index.html index.htm;\r\n    charset utf-8;\r\n    ssl_certificate \/etc\/letsencrypt\/live\/hogehoge\/fullchain.pem;\r\n    ssl_certificate_key \/etc\/letsencrypt\/live\/hogehoge\/privkey.pem;\r\n    location \/ {\r\n        try_files $uri $uri\/ @wordpress;\r\n    }\r\n    ---\u7565\r\n}\r\n<\/code><\/pre>\n<p>\u6211\u4eec\u53ef\u4ee5\u6839\u636eLet&#8217;s Encrypt\u8bc1\u4e66\u7684\u6709\u6548\u671f\u9650\uff0c\u5728cron\u7b49\u5de5\u5177\u4e2d\u9884\u5148\u8bbe\u7f6e\u81ea\u52a8\u66f4\u65b0\uff0c\u8fd9\u6837\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<hr \/>\n<p>\u57fa\u672c\u4e0a\u5c31\u662f\u4ee5\u4e0a\uff0c\u4f46\u8fd8\u9700\u8981\u5e94\u7528WordPress\u7684\u4e3b\u9898\u3001\u6570\u636e\u5e93\u5907\u4efd\u548c\u63d2\u4ef6\u624d\u80fd\u5b8c\u6210\u3002<\/p>\n<h1>\u5c06PHP\u7248\u672c\u5347\u7ea7\u81f37.3<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cff4e37434c4406bc82cd\/144-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2020-06-14 15.52.08.png\" \/><\/p>\n<pre class=\"post-pre\"><code>\/\/ \u524a\u9664\r\n$ sudo yum remove php-*\r\n\r\n\/\/ \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\r\n$ sudo yum -y install --enablerepo=remi-php73 php php-cli php-common php-devel php-fpm php-gd php-mbstring php-mysqlnd php-pdo php-pear php-pecl-apcu php-soap php-xml php-xmlrpc\r\n<\/code><\/pre>\n<h2>PHP-FPM\u7684\u8bbe\u7f6e\u53ef\u80fd\u57287.1\u7248\u672c\u7684\u64cd\u4f5c\u6b65\u9aa4\u4e2d\u53ef\u80fd\u9057\u6f0f\u4e86\u4e00\u4e9b\u5185\u5bb9\uff0c\u4f46\u5f53\u66f4\u65b0\u5230PHP7.3\u65f6\uff0c\u9664\u4e86user\u548cgroup\u4e4b\u5916\u7684\u5176\u4ed6\u90e8\u5206\u4e5f\u9700\u8981\u8fdb\u884c\u7f16\u8f91\u3002<\/p>\n<pre class=\"post-pre\"><code># vi \/etc\/php-fpm.d\/www.conf\r\n---\r\n;listen = 127.0.0.1:9000\r\nlisten = \/var\/run\/php-fpm\/php-fpm.sock\r\n\r\n;user = apache\r\nuser = nginx\r\n\r\n;group = apache\r\ngroup = nginx\r\n\r\n;listen.owner = nobody\r\n;listen.group = nobody\r\n;listen.mode = 0660\r\nlisten.owner = nginx\r\nlisten.group = nginx\r\nlisten.mode = 0666\r\n---\r\n\r\n# systemctl stop php-fpm\r\n# systemctl start php-fpm\r\n# systemctl stop nginx\r\n# systemctl start nginx\r\n<\/code><\/pre>\n<h3>\u5728\u5fd8\u8bb0\u4e0a\u8ff0\u8bbe\u7f6e\u65f6\u51fa\u73b0\u7684Nginx\u9519\u8bef<\/p>\n<pre class=\"post-pre\"><code>2020\/06\/14 16:28:00 [crit] 28320#28320: *2 connect() to unix:\/var\/run\/php-fpm\/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: hogehoge.com, request: \"GET \/favicon.ico HTTP\/1.1\", upstream: \"fastcgi:\/\/unix:\/var\/run\/php-fpm\/php-fpm.sock:\", host: \"hogehoge.com\", referrer: \"https:\/\/hogehoge.com\/wp\/\"\r\n<\/code><\/pre>\n<h1>\u7eed\u96c6<\/p>\n<ul class=\"post-ul\">Nginx+PHP7.1+MariaDB\u306ephpMyAdmin\u3092\u69cb\u7bc9<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u6211\u8bd5\u56fe\u5c06\u6a31\u82b1VPS\u7684\u8ba1\u5212\u4ece1GB\u5347\u7ea7\u52302GB\u65f6\uff0c\u53d1\u73b0\u6211\u5f53\u524d\u7684v3\u5957\u9910\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\uff0c\u6240\u4ee5\u6211\u4ece\u5934\u5f00\u59cb\u91cd\u65b0\u642d\u5efa\u4e86\u670d [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-28989","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8e\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordP\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728\u6a31\u82b1vps\uff08centos7\uff09\u4e0a\uff0c\u642d\u5efanginxphp7-1\uff087-3\uff09mariadb\u7684wordpress\u7f51\u7ad9\uff08\u652f\u6301https\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8e\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordP\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728\u6a31\u82b1vps\uff08centos7\uff09\u4e0a\uff0c\u642d\u5efanginxphp7-1\uff087-3\uff09mariadb\u7684wordpress\u7f51\u7ad9\uff08\u652f\u6301https\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-30T04:16:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-12T03:10:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cff4e37434c4406bc82cd\/8-0.png\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/\",\"name\":\"\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-11-30T04:16:13+00:00\",\"dateModified\":\"2025-08-12T03:10:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"description\":\"\u5173\u4e8e\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordP\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09 - Blog - Silicon Cloud","description":"\u5173\u4e8e\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordP\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728\u6a31\u82b1vps\uff08centos7\uff09\u4e0a\uff0c\u642d\u5efanginxphp7-1\uff087-3\uff09mariadb\u7684wordpress\u7f51\u7ad9\uff08\u652f\u6301https\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09","og_description":"\u5173\u4e8e\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordP\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728\u6a31\u82b1vps\uff08centos7\uff09\u4e0a\uff0c\u642d\u5efanginxphp7-1\uff087-3\uff09mariadb\u7684wordpress\u7f51\u7ad9\uff08\u652f\u6301https\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-11-30T04:16:13+00:00","article_modified_time":"2025-08-12T03:10:15+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657cff4e37434c4406bc82cd\/8-0.png"}],"author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/","name":"\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-11-30T04:16:13+00:00","dateModified":"2025-08-12T03:10:15+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"description":"\u5173\u4e8e\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordP\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5728\u6a31\u82b1VPS\uff08CentOS7\uff09\u4e0a\uff0c\u642d\u5efaNginx+PHP7.1\uff087.3\uff09+MariaDB\u7684WordPress\u7f51\u7ad9\uff08\u652f\u6301HTTPS\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e6%a8%b1%e8%8a%b1vps%ef%bc%88centos7%ef%bc%89%e4%b8%8a%ef%bc%8c%e6%90%ad%e5%bb%banginxphp7-1%ef%bc%887-3%ef%bc%89mariadb%e7%9a%84wordpress%e7%bd%91%e7%ab%99%ef%bc%88%e6%94%af%e6%8c%81https\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=28989"}],"version-history":[{"count":3,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28989\/revisions"}],"predecessor-version":[{"id":111422,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28989\/revisions\/111422"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=28989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=28989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=28989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}