这次并不是换了博客的宿主,而是更换了博客的主机(VPS)。换到国外的服务器去了,虽然响应时间慢了点,但整体的速度要比以前的虚拟主机要快。

这次搬家的过程中,碰到了些容易出现的问题。

比如MySQL数据库的编码问题,这个配置MySQL的时候,要注意增加配置


[client]
 default-character-set = utf8

[mysqld]
 default-character-set = utf8

下面的这些语句可能对你有用:

alter database blog character set utf8;
create database mydb character set utf-8;

SHOW VARIABLES LIKE 'character_set_%';
SHOW VARIABLES LIKE 'collation_%';

当然在配置Nginx上也要注意一个地方,这样就支持了wordpress的伪静态

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    server {
        listen       80;
        server_name  www.herbertyang.com;
        access_log  logs/blog.access.log  main;
        location / {
	    add_header Content-Type "text/html; charset=UTF-8";
            add_header Content-Encoding "gzip";
	    try_files $uri $uri/ /index.php?q=$uri&$args;
            root   /home/app/phproot/wordpress;
            index  index.php index.html index.htm;
        }
	location ~* \.(jpg|jpeg|png|gif|css|js|swf|mp3|avi|flv|xml|zip|rar)$ {
		expires 30d;
        	gzip on;
       		gzip_types  text/plain application/x-javascript text/css application/xml;
		root   /home/app/phproot/wordpress;
	}
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /home/app/phproot/wordpress$fastcgi_script_name;
            include        fastcgi_params;
        }
        location ~ /\.ht {
           deny  all;
        }
    }

最后也把Wordpress加上了Memcached,速度还是快了一点,响应的速度有点慢,不过感觉流畅很多。

参考网址:
http://blog.s135.com/nginx_php_v6/
http://www.23day.com/html/22890.html
http://www.nonabyte.net/nginx-wordpress-rewrite/