在nginx环境下同一个网站目录下放2个或者多个zblog程序nginx伪静态规则如何写
昨天升级完内核,主站主域名下还有2个zblog程序,升级完后忘记以前伪静态规则咋写了,zblog本身的是:
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;
}
昨晚没搞定,经过搜索查阅资料一顿搞,ok:
如下:
location /news/ {
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 (.*) /news/index.php;
}
}
location /lm/ {
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 (.*) /lm/index.php;
}
}
参考此代码,不管多少个都可以,理论上。