A-A+

Nginx下wordpress的Rewrite

2016年11月18日 WordPress 暂无评论 阅读 1,417 views 次

最近自己在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;
}

}

希望能给大家带来一些帮助吧!

标签:

给我留言

Copyright © 严佳冬 保留所有权利.   Theme  Ality 百度地图 苏ICP备19045515号-2

用户登录

分享到: