Skip to content

Instantly share code, notes, and snippets.

@dingyaguang117
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dingyaguang117/77098e42f9614649f034 to your computer and use it in GitHub Desktop.
Save dingyaguang117/77098e42f9614649f034 to your computer and use it in GitHub Desktop.
# 把形如 /article/ 变成 /article/index.php
location ~ ^/article[^.]*/$
{
rewrite ^(.*)$ $1index.php last;
}
# 之所以没有用$fastcgi_script_name是因为,$fastcgi_script_name会带上/article前缀,导致404,所以我自己获取了脚本的路径
# 应该有更正确的方式去掉/article?
location ~ ^/article/(.*)$ {
alias /usr/local/nginx-1.6.2/html/wordpress/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $fastcgi_script_name_new $1;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx-1.6.2/html/wordpress/$fastcgi_script_name_new;
include fastcgi_params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment