A-A+
Nginx下wordpress的Rewrite
最近自己在nginx下搭建了一个博客站点,这是第一次在nginx安装搭建wordpress,确实遇到很多问题,并不是很顺利,下面就把自己最后成功运行的vhost的配置文件给大家参考:
server
{
listen 80;
server_name blog.yanjiadong.net;
index index.php index.html index.htm;
root /home/wwwroot/wordpress;
location / {
#try_files $uri $uri /index.php$uri;
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;
}
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~ [^/]\.php(/|$)
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;
}
}
希望能给大家带来一些帮助吧!