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回车,出现如下界面说明配置对了
配置博客:点击上图“现在就开始”,填写如下信息,点击提交,出现下一个界面点击“进行安装”
然后继续根据下图操作:
写文章发表博客
发表一篇有图片和文字的博客,如下所示:
至此博客已经安装。
本文转自sandshell博客51CTO博客,原文链接http://blog.51cto.com/sandshell/1959655如需转载请自行联系原作者
sandshell