最近网站搬家从windows上搬到liunx服务器上,搬家可能会出现很多问题,也需要配置vhost.conf
wordpress 自带的重写规则都是关于apache的,本文将介绍如何配制nginx下的wordpress重写规则。
规则如下:

#-+-+-+-+-+-+-+-+-+-+ id: 1 --- ftp name:  --- user: 91bianmei.com +-+-+-+-+-+-+-+-+-+
server
{
   server_name 91bianmei.com www.91bianmei.com bianmei.zhenyoumei.com.cn;
	listen       80;

	if ($http_transfer_encoding ~* chunked) {
		return 444;
	}
	gzip on;

	location / {
	 if (!-e $request_filename) 
	 {
	 	rewrite  ^/index.php/(.*)$  /index.php?s=$1  last;
	        rewrite  ^/(.*)$  /index.php?s=$1  last;
	        break;
	  }
}
	 root   /mnt/www/bianmei.zhenyoumei.com.cn/;
	#------------
	 location ~* ^(.+)\.(php[3-9]?|phtm[l]?)(\/.*)*$ {
		 set $real_script_name $1.$2;
		 set $path_info $3;

		 if (!-f $document_root$real_script_name) {
			 return 404;
		 }

		  fastcgi_pass 127.0.0.1:8999;

		  include enable_php.conf;
	 }
}

转载请注明转自:运达's blog 原文地址:http://www.yunda51.com/1286.html