Posts tagged Memcached
把wordpress搬到nginx环境
Sep 9th
这次并不是换了博客的宿主,而是更换了博客的主机(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/
抛弃在Hibernate的二级缓存使用Memcached
Jul 19th
Memcached就像一个调皮的精灵,在你困难的时候,他会跳出来帮你一把,那绝对是雪中送。
不过,也如精灵的天性一样,喜欢冲破任何约束,感觉都不太可靠。
在Hibernate的二级缓存加上Memcached,似乎是把这个精灵捆住了,也正因为如此,Memcached不再是Memcached了。
扔掉这种想法吧,如果你使用了Memcached,就要做好他上窜下窜的准备,这就是他的魅力。