1、部署LNMP环境
部署MySQL环境,并启动服务
yum -y install mariadb
systemctl start mariadb.service
部署PHP环境,并启动php-fpm服务。(确保Linux可以连接外网)
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 install php72-php-fpm php72-php-common php72-php-mbstring php72-php-xmlrpc php72-php-soap php72-php-gd php72-php-xml php72-php-intl php72-php-mysql php72-php-cli php72-php-zip php72-php-curl
systemctl start php-fpm.service #启动php-fpm服务
启动Nginx服务(安装Nginx的步骤请看链接:https://blog.csdn.net/vincen123/article/details/82948728)
systemctl start nginx.service
2、创建一个名为 wds 的数据库,并为该数据库创建一个用户,赋予权限
MariaDB [(none)]> create database wds; #创建名为wds的数据库
MariaDB [(none)]> grant all privileges on wds.* to wds@'localhost' identified by '123456';
#对于wds数据库创建一个wds用户,密码为123456,赋予这个用户对于wds数据库的所有权限
MariaDB [(none)]> flush privileges; #刷新权限表
3、在 /opt/wordpress 目录里下载WordPress中文版的源码包,并解压
mkdir /opt/wdcode
cd /opt/wdcode
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
tar -zvxf wordpress-4.9.4-zh_CN.tar.gz
3、修改Nginx配置文件
vim /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
root /opt/wdcode;
location / {
try_files $uri $uri/ /index.php?$args;
index index.php index.html index.htm;
}
## PHP配置 ##
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
检查Nginx配置语法
nginx -tc /etc/nginx/nginx.conf
4、重新载入Nginx服务
nginx -s reload -c /etc/nginx/nginx.conf
在浏览器访问(linuxIP): 172.25.0.20
遇到上面这种情况,先在wordpress目录下查看是否有wp-config.php文件,如果有则在 /opt/wdcode 路径下执行 chown -R nginx wordpress/ 命令,然后再回到网页页面点击“现在安装”。
如果在wordpress目录下没有wp-config.php文件,则在/opt/wdcode目录下创建名为 wp-config.php ,并将页面上的提示把那些信息复制到这个文件里,然后保存并退出。回到页面上点击进行下一步安装。
填好信息点击安装后,就已经安装完成了