一、安装PHP、NGINX、MYSQL
yum remove php-*
yum list installed | grep php
# Wordpress版本较新,php版本过低,升级PHP
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum search php7
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
php -v
systemctl restart php-fpm
[root@iZbp19x4magli14cjyd94sZ ~]# yum -y install nginx
[root@iZbp19x4magli14cjyd94sZ ~]# cat /etc/nginx/conf.d/wordpress.conf
server {
listen 80;
server_name word.test.com;
include /etc/nginx/default.d/*.conf;
location / {
root /data/wordpress;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /data/wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
#创建Wordpress库名
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| wordpress |
+--------------------+
5 rows in set (0.00 sec)
# 授权用户
mysql> grant all on wordpress.* to wordpress@'%' identified by '123456';
二、下载Wordpress、解压
[root@iZbp19x4magli14cjyd94sZ wordpress]# wget https://cn.wordpress.org/latest-zh_CN.tar.gz
[root@iZbp19x4magli14cjyd94sZ wordpress]# tar -xf latest-zh_CN.tar.gz
[root@iZbp19x4magli14cjyd94sZ wordpress]# mv wordpress /data/
[root@iZbp19x4magli14cjyd94sZ wordpress]# cp wp-config-sample.php wp-config.php
三、访问网址
安装界面
汉化wordpress
配置文件中加入:define('WPLANG','zh_CN');
接着点击update更新
四、Wordpress 下载主题需要ftp登录解决
cat ../wp-config.php
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
define("FS_METHOD", "direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777); # 添加此三行
chmod -R +777 /data/wordpress/wp-content/ # 加权限后无需FTP
|