概述:wordpress可以很方便的重写(Rewrite),但是在nginx需要在nginx站点配置文件里,下面是我针对wordpress写的配置文件
server
{
listen 80;
server_name vps.15099.net;
index index.html index.htm index.php;
root /data0/htdocs/vps;
#limit_conn crawler 20;
# 重写代码开始
location / {
index index.html index.php;
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 (.*) /index.php;
}
}
#重写代码结束
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
# Blog more pictures, less change, they will be in the local browser cache 15 days, you can improve the next time I open the blog page loading speed
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 15d;
}
#Blog will be a lot of load javascript, CSS, they will be in the local browser cache 1 day, to improve the speed of page display
location ~ .*\.(js|css)?$
{
expires 1d;
}
}
没有评论:
发表评论