Home > ubuntu, 杂七杂八 > wordpress迁移点滴

wordpress迁移点滴

昨天把主机从dreamhost换到了linode,虽然觉得dreamhost很不错 但是没有root权限始终有点不快。

今年打算把服务器,运维等知识好好补充一下,于是买了口碑一直不错的linode的VPS。

第一天的任务就是 迁移博客。

1. scp把wordpress文件 都拷贝至新主机上

2.apt-get 安装mysql php5 php5-mysql php5-cgi libfcgi-dev spawn-fcgi nginx

3.使用spawn-fcgi 脚本 启动php5-cgi进程

sudo spawn-fcgi -f /usr/bin/php5-cgi -a 127.0.0.1 -p 9000 -C 3 -P /var/run/php5-cgi.pid

4.配置nginx

在/etc/nginx/sites-enabled下创建 yakjuly.com文件

server {
        listen   80;
        server_name yakjuly.com;

        access_log  /home/yakjuly/applications/yakjuly.com/log/access.log;
        error_log /home/yakjuly/applications/yakjuly.com/log/error.log;
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;

        location / {
                root   /home/yakjuly/applications/yakjuly.com;
                index  index.php index.html index.htm;

                if (-f $request_filename/index.html){
                        rewrite (.*) $1/index.html break;
                }
                if (-f $request_filename/index.php){
                        rewrite (.*) $1/index.php;
                }
                if (!-e $request_filename){
                         rewrite . /index.php;
                }
        }

        location ~ .*\.php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param   SCRIPT_FILENAME /home/yakjuly/applications/yakjuly.com$fastcgi_script_name;
        }
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
解决了 /wp-admin 和/wp-admin/ 产生的url地址不一致的错误。
5.wordpress中文显示乱码。
在dreamhost时数据库是latin1,在导入linode时已经转化为了utf8 而且在mysql console中显示正常,说明是php的设置问题。
添加以下内容到wp-config.php
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', 'uft8_general_ci');
6.域名指向
登陆godaddy设置域名A记录指向新主机ip地址
10分钟后就生效了 感叹godaddy的神速 V5
新blog的访问速度明显比原来快得多。
Categories: ubuntu, 杂七杂八 Tags:
  1. No comments yet.
  1. No trackbacks yet.