1)软件准备

软件包 版本 大小
lnmp1.7.tar.gz 1.7 165kB
wordpress-4.7.3-zh_CN.zip 4.7.3 8995KB
CentOS-7-x86_64-DVD-1511.iso 1511 4.03GB

2)运行lnmp包

  1. tar -zxf lnmp1.7.tar.gz
  2. cd lnmp1.7
  3. ./install.sh

一直回车就可,
记得最后看mysql的密码

3)配置MySQL

  1. mysql -uroot -plnmp.org#你自己的mysql的密码
  2. mysql> create database wordpress;
  3. mysql> grant all privileges on *.* to root@localhost identified by '000000' with grant option;
  4. mysql> grant all privileges on *.* to root@"%" identified by '000000' with grant option;
  5. mysql> exit

4)配置wordpress

  1. 解压wordpress
  2. unzip wordpress-4.7.3-zh_CN.zip tar -zxvf
  3. ls
  4. # 删除nginx默认文件
  5. rm -rf /home/wwwroot/default/index.html
  6. # 把wordpress文件 全部复制到nginx的默认目录当中
  7. cp -rvf wordpress/* /home/wwwroot/default/
  8. ls /home/wwwroot/default/
  9. # 赋予777权限
  10. chmod 777 /home/wwwroot/default/*
  11. # 修改wordpress模板
  12. cd /home/wwwroot/default/
  13. ls
  14. cp wp-config-sample.php wp-config.php
  15. vi wp-config.php

image.png
若是新的环境则不需要改变配置文件
如果你是lnmp环境下配置的话

  1. 进入vhosts
  2. cd /usr/local/nginx/conf/vhost/
  3. mkdir aa
  4. 将配置文件移入到aa
  5. mv default.conf load.conf proxy.conf ssl.conf test.com.conf aa
  6. vim aa.conf
  7. server
  8. {
  9. location ~ \.php$ {
  10. root /var/www/html;
  11. fastcgi_pass 127.0.0.1:9000;
  12. fastcgi_index index.php;
  13. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  14. include fastcgi_params;
  15. }
  16. }
  17. 重启
  18. service nginx restart

在浏览器中输入虚拟机IP地址,进入wordpress安装界面,填写必要信息,单机左下角安装按钮即可。
配置站点名和你自己的用户名 添加自己的密码和邮箱然后点击安装
登录
image.png