1 配置相关资料库
登入 mysql
1
[root@web01 blog]# mysql -uroot -p123456
显示所有的资料库:
1
show databases;
显示如下:
1
2
3
4
5
6
7
8
9
10
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
4 rows in set (0.05 sec)
用命令 drop database test; 把没有用的 test 资料库删除
1
2
mysql> drop database test;
Query OK, 0 rows affected (0.06 sec)
继续 show databases; 检视资料库数量
1
2
3
4
5
6
7
8
9
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)
用命令 create database wordpress; 建立一个专用的资料库 wordpress,用于存放 blog 资料。
1
2
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)
用命令 show databases; 再检视资料库数量
1
2
3
4
5
6
7
8
9
10
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| wordpress |
+——————–+
4 rows in set (0.00 sec)
检视谁是资料库管理员 select user();
1
2
3
4
5
6
7
mysql> select user();
+—————-+
| user() |
+—————-+
| root@localhost |
+—————-+
1 row in set (0.00 sec)
检视系统谁是系统管理员 system whoami
1
2
mysql> system whoami
root
检视 mysql 资料库的所有使用者 select user,host from mysql.user;
1
2
3
4
5
6
7
8
9
10
11
12
mysql> select user,host from mysql.user;
+——+———–+
| user | host |
+——+———–+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| | web01 |
| root | web01 |
+——+———–+
6 rows in set (0.00 sec)
建立 wordpress 使用者针对于 wordpress 里面的所有表管理
grant all on wordpress.* to wordpress@’localhost’ identified by ‘123456’;
1
2
mysql> grant all on wordpress.* to wordpress@’localhost’ identified by ‘123456’;
Query OK, 0 rows affected (0.00 sec)
查询下刚刚增加的使用者是否生效 select user,host from mysql.user;
1
2
3
4
5
6
7
8
9
10
11
12
13
mysql> select user,host from mysql.user;
+———–+———–+
| user | host |
+———–+———–+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| wordpress | localhost |
| | web01 |
| root | web01 |
+———–+———–+
7 rows in set (0.00 sec)
检视使用者对应的许可权 show grants for wordpress@’localhost’;
1
2
3
4
5
6
7
8
mysql> show grants for wordpress@’localhost’;
+——————————————————————————————————————+
| Grants for wordpress@localhost |
+——————————————————————————————————————+
| GRANT USAGE ON *.* TO ‘wordpress’@’localhost’ IDENTIFIED BY PASSWORD ‘*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9’ |
| GRANT ALL PRIVILEGES ON `wordpress`.* TO ‘wordpress’@’localhost’ |
+——————————————————————————————————————+
2 rows in set (0.00 sec)
重新整理资料库,让许可权生效 flush privileges;
1
2
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
调整 nginx+php
1
2
[root@web01 blog]# cd /application/nginx/conf/extra/
[root@web01 extra]# vim blog.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {
listen 80;
server_name blog.etiantian.org;
location / {
root html/blog;
index index.php index.html index.htm;
}
location ~ .*.(php|php5)?$ {
root html/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
2 下载博客网站
输入地址:https://cn.wordpress.org/ 复制 tar 版本路径 https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz
然后再下载博客网站程式
1
2
[root@web01 extra]# cd /home/oldboy/tools
[root@web01 tools]# wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz
解压 wordpress
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@web01 tools]# ll
total 212988
drwxr-xr-x 22 root root 4096 Aug 24 21:05 libiconv-1.14
-rw-r–r– 1 root root 4984397 Aug 8 2011 libiconv-1.14.tar.gz
-rw-r–r– 1 root root 185870973 Aug 23 19:57 mysql-5.5.49-linux2.6-x86_64.tar.gz
drwxr-xr-x 9 1001 1001 4096 Aug 19 16:11 nginx-1.6.3
-rw-r–r– 1 root root 805253 Apr 8 2015 nginx-1.6.3.tar.gz
drwxr-xr-x 17 1001 1001 4096 Aug 24 23:45 php-5.5.32
-rw-r–r– 1 root root 17773092 Aug 24 21:24 php-5.5.32.tar.gz
-rw-r–r– 1 root root 8641990 Aug 4 15:54 wordpress-4.8.1-zh_CN.tar.gz
[root@web01 tools]# tar xf wordpress-4.8.1-zh_CN.tar.gz
[root@web01 tools]# ls wordpress
index.php wp-admin wp-content wp-load.php wp-signup.php
license.txt wp-blog-header.php wp-cron.php wp-login.php wp-trackback.php
readme.html wp-comments-post.php wp-includes wp-mail.php xmlrpc.php
wp-activate.php wp-config-sample.php wp-links-opml.php wp-settings.php
拷贝到博客网站下面
1
[root@web01 tools]# cp -a wordpress/* /application/nginx/html/blog/
1
2
3
4
5
6
[root@web01 tools]# ls /application/nginx/html/blog/
index.html test_mysql.php wp-config-sample.php wp-load.php wp-trackback.php
index.php wp-activate.php wp-content wp-login.php xmlrpc.php
license.txt wp-admin wp-cron.php wp-mail.php
readme.html wp-blog-header.php wp-includes wp-settings.php
test_info.php wp-comments-post.php wp-links-opml.php wp-signup.php
设定许可权
1
[root@web01 tools]# chown -R www.www /application/nginx/html/blog/
检视许可权
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@web01 tools]# ll /application/nginx/html/blog/
total 200
-rw-r–r– 1 www www 5 Aug 19 23:17 index.html
-rw-r–r– 1 www www 418 Sep 25 2013 index.php
-rw-r–r– 1 www www 19935 Jan 3 2017 license.txt
-rw-r–r– 1 www www 6956 Aug 4 15:54 readme.html
-rw-r–r– 1 www www 20 Aug 25 00:35 test_info.php
-rw-r–r– 1 www www 167 Aug 27 00:11 test_mysql.php
-rw-r–r– 1 www www 5447 Sep 28 2016 wp-activate.php
drwxr-xr-x 9 www www 4096 Aug 4 15:54 wp-admin
-rw-r–r– 1 www www 364 Dec 19 2015 wp-blog-header.php
-rw-r–r– 1 www www 1627 Aug 29 2016 wp-comments-post.php
-rw-r–r– 1 www www 2930 Aug 4 15:54 wp-config-sample.php
drwxr-xr-x 5 www www 4096 Aug 4 15:54 wp-content
-rw-r–r– 1 www www 3286 May 25 2015 wp-cron.php
drwxr-xr-x 18 www www 12288 Aug 4 15:54 wp-includes
-rw-r–r– 1 www www 2422 Nov 21 2016 wp-links-opml.php
-rw-r–r– 1 www www 3301 Oct 25 2016 wp-load.php
-rw-r–r– 1 www www 34327 May 13 01:12 wp-login.php
-rw-r–r– 1 www www 8048 Jan 11 2017 wp-mail.php
-rw-r–r– 1 www www 16200 Apr 7 02:01 wp-settings.php
-rw-r–r– 1 www www 29924 Jan 24 2017 wp-signup.php
-rw-r–r– 1 www www 4513 Oct 15 2016 wp-trackback.php
-rw-r–r– 1 www www 3065 Sep 1 2016 xmlrpc.php
检查语法,重启 nginx
1
2
3
4
[root@web01 tools]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful
[root@web01 tools]# /application/nginx/sbin/nginx -s reload
浏览器中输入 blog.etiantian.org 回车,出现如下介面说明配置对了
配置博客网站:点选上图 “现在就开始”,填写如下资讯,点选提交