server {
listen 80;
server_name domain.cn;
root document_root;
index index.php;
charset utf-8;
if ($request_filename !~* ^/(.*)\.php$) {
rewrite ^/(.*)$ /index.php?$1 last;
}
location ~ .*\.(php|php5|php7)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
只允许合法模块 admin, index 走 FastCGI 协议
<VirtualHost *:80>
DocumentRoot "document_root"
ServerName domain.cn
ServerAlias www.domain.cn
ProxyPassMatch ^(/admin/index/)(.*)$ fcgi://126.0.0.1:9000/tmp/asf/index.php/$1
</VirtualHost>