nginx 伪静态后台404解决规则
nginx 伪静态后台404解决规则
启动静态后,发现后台404报错了,所以研究了一下,现在分享出来给大家
顺便自己在加了点目录禁止运行php,防止小黑传马都被日!
location / {
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;
}
}
location ~* ^/(tpl|attachment)/.*.(php|php5)$ {
deny all;
}
分享精神!
启动静态后,发现后台404报错了,所以研究了一下,现在分享出来给大家
顺便自己在加了点目录禁止运行php,防止小黑传马都被日!
location / {
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;
}
}
location ~* ^/(tpl|attachment)/.*.(php|php5)$ {
deny all;
}
分享精神!

回复列表(7)