LNMP搭建wordpress博客
【LNMP以开源博客】
##############环境准备#############################
1.登录数据库创建用于存储数据库的wordpress库,存储博客数据
mysql> create database wordpress;
Query OK, 1 row affected (0.02 sec)
mysql> show databases like 'wordpress';
+----------------------+
| Database (wordpress) |
+----------------------+
| wordpress |
+----------------------+
1 row in set (0.01 sec)
2.创建专用于wordpress的数据库用户
mysql> grant all on wordpress.* to wordpress@'localhost' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.01 sec)
3.刷新权限表
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
4.查询用户信息
mysql> select user,authentication_string,host from mysql.user;
+---------------+-------------------------------------------+-----------+
| user | authentication_string | host |
+---------------+-------------------------------------------+-----------+
| root | *83F7A15725AF362EF5EAFC16E1F3F97FDAB9B411 | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
| wordpress | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost |
+---------------+-------------------------------------------+-----------+
4 rows in set (0.00 sec)
5.nginx配置,选择blog虚拟主机配置,添加一个index.php参数
[root@web01 conf]# cat extra/03_blog.conf
server {
listen 80;
server_name _;
location / {
root html/blog;
index index.php index.html; #在这里新增
}
#添加有关php程序的解析
location ~ .*\.(php|php5)?$ {
root html/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
【wordpress博客程序准备】
1.下载获取wordpress程序
wget https://wordpress.org/latest.zip
wget https://wordpress.org/latest.tar.gz
2.超哥机器上的资料
[root@web01 conf]# ls /home/chaoge/tools/wordpress-5.3.2.*
/home/chaoge/tools/wordpress-5.3.2.tar.gz /home/chaoge/tools/wordpress-5.3.2.zip
3.解压缩zip版代码
[root@web01 tools]# yum install unzip -y
[root@web01 tools]# unzip wordpress-5.3.2.zip
[root@web01 tools]# mv wordpress /opt/nginx/html/blog/
[root@web01 tools]# cd /opt/nginx/html/blog/
[root@web01 blog]# ls
test_mysql.php wordpress
4.移动worpress代码到nginx目录下,且授权
[root@web01 blog]# mv wordpress/* .
[root@web01 blog]# ls
index.php wordpress wp-comments-post.php wp-includes wp-mail.php xmlrpc.php
license.txt wp-activate.php wp-config-sample.php wp-links-opml.php wp-settings.php
readme.html wp-admin wp-content wp-load.php wp-signup.php
test_mysql.php wp-blog-header.php wp-cron.php wp-login.php wp-trackback.php
[root@web01 blog]#
[root@web01 blog]#
[root@web01 blog]# chown -R nginx.nginx ../blog/
5.最后一步,注意别忘记重启nginx
nginx -s reload
【访问安装wordpress】
按提示一步步操作下去即可
到此博客站点就搭建好了