计算机网络/计算机科学与应用/系统/运维/开发

LNMP环境搭建wordpress

lnmp环境搭建wordpress

环境准备

1.启动mysql数据库

#mysql -u root -p


2. 创建数据库

mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)


3.创建用于wordpress专用的数据库

create user  wordpress;


4.给该用户授权

给wordpress用户授权  允许localhost 本地登录

grant  all on wordpress.*  to wordpress@'localhost' identified by '123456';


5. 刷新授权表

flush privileges;


6.查询刚才创建的用户信息

use mysql;
show tables;
desc user;
select user,authentication_string,host from mysql.user;


确保nginx 支持php程序的解析

server {
   listen  80;
   server_name _;
   location / {
      root  html/myphp;
      index index.php  index.html;
   }
   # 添加有关php程序的解析
   # 判断当请求url结尾是以php,php5的时候,就进入如下的location代码
   location ~ .*\.(php|php5)?$ {
      root html/myphp;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index  index.php;
      include fastcgi.conf;
   }
}


[root@VM-4-2-centos extra]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
nginx -s reload


下载wordpress 

wget https://wordpress.org/latest.tar.gz


解压:

tar -zxvf  latest.tar.gz


将下载后的wordpress程序解压后 移动到nginx的程序目录下

[root@VM-4-2-centos ~]# mv wordpress /usr/local/nginx/html/myphp/


进入到nginx 中 存放wordpress目录下

[root@VM-4-2-centos ~]# cd /usr/local/nginx/html/myphp/
[root@VM-4-2-centos myphp]# ll
total 12
-rw-r--r-- 1 root   root    52 Aug  2 12:16 index.php
-rw-r--r-- 1 root   root   389 Aug  2 15:49 test_mysql.php
drwxr-xr-x 5 nobody 65534 4096 Jul 13 00:16 wordpress


将 wordpress中所有文件 移动到当前目录下

[root@VM-4-2-centos myphp]# mv wordpress/* .

访问ip地址安装wordpress程序  完毕


参考文献 

https://blog.csdn.net/ichen820/article/details/117003189


努力的意义,不在于一定会让你取得多大的成就,只是让你在平凡的日子里,活得比原来的那个自己更好一点。

评论

^