1. 数据库同在一台服务器安装wordpress
[root@web01 blog]# rz -y[root@web01 blog]# unzip wordpress-4.6.zip[root@web01 blog]# mv wordpress-4.6.zip /tools/[root@web01 blog]# mv wordpress/* .[root@web01 blog]# chown -R nginx.nginx blog/[root@web01 blog]# /application/nginx/sbin/nginx -t[root@web01 blog]# /application/nginx/sbin/nginx -s reload
2. 数据库迁移操作,实现不同服务器搭建
mysqldump -uroot -p123456 -A -B --events|gzip >/tmp/bak.sql.gzscp /tmp/bak.sql.gz root@172.16.1.51:/tools改hosts172.16.1.8 web01172.16.1.51 db01 db01.etiantian.org
3.创建数据库用户和库
mysql> create database wordpress;Query OK, 1 row affected (0.01 sec)mysql> grant all on wordpress.* to wordpress@'172.16.1.%' identified by 'oldboy123';Query OK, 0 rows affected (0.07 sec)mysql> flush privileges;Query OK, 0 rows affected (0.09 sec)mysql> quitBye
-------------------------------------------------------------------------------------------------
Blog标签配置内容:
server {
listen 80;
server_name blog.etiantian.org;
root html/blog;
index index.php index.html index.htm;
location / {
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) $1/index.php;
}
}
location ~ .*.(php|php5)?$ {
root html/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
网页博客规则设置如下:
/archives/%post_id%.html