1.安装 nginx
nginx.conf 配置
https://developer.wordpress.org/advanced-administration/server/web-server/nginx/
upstream blog_php {
server unix:/run/php-fpm/www.sock;
}
server {
listen 80;
listen 443 ssl;
server_name blog.rebatesme.com;
index index.php;
root /data/service/nginx/wordpress;
server {
listen 80;
listen 443 ssl;
server_name blog.rebatesme.com;
index index.php;
root /data/service/nginx/wordpress;
ssl_certificate /usr/local/nginx/conf/ssl/rebatesme.com.pem;
ssl_certificate_key /usr/local/nginx/conf/ssl/rebatesme.com.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DHE;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
location ~ \.php$ {
fastcgi_pass blog_php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/(status)$ {
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
allow 127.0.0.1;
allow 10.1.0.0/16;
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
}
2.安装 php
yum install php php-mysqlnd php-mbstring php-fpm php-xml php-pdo php-cli php-odbc php-gd php-common
systemctl start php-fpm.service
3.安装 wordpress
3.1 多站点设置:
# 修改配置
cd wordpress
cp wp-config-sample.php wp-config.php
# 配置数据库
define( 'DB_NAME', 'database_name_here' );
/** Database username */
define( 'DB_USER', 'username_here' );
/** Database password */
define( 'DB_PASSWORD', 'password_here' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );
# 启用多站点或多域名功能
/* Add any custom values between this line and the "stop editing" line. */
define('WP_ALLOW_MULTISITE', true);
https://IP 登录,设置账号密码,
登录:https://IP/wp-login.php
选择工具---》配置网络:选择方式----》安装
子目录安装和子域名安装方式,在这个地方选择
安装完成后,将配置粘贴到 wp-login.php
/* That's all, stop editing! Happy publishing. */
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'blog.xx.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
重新登录,添加站点:
四、安装主题、插件,添加用户
插件:W3 Super Cache
chmod -R 777 wp-content
设置,启用缓存和 CDN功能,将