Now many RESTful frameworks, or frameworks that support pathinfo routing mode, will hide the entry file index.* in the URL. So, in this case, how to configure nginx so that it can determine whether the request is a dynamic request that requires program processing, or a static file request?
phpcn_u15822017-05-16 17:28:50
location /
{
index index.php;
# 重写到index
if ($request_filename !~ (js|css|images|robots/.txt|index/.php.*) ) {
rewrite ^/(.*)$ /index.php/ last;
break;
}
}
滿天的星座2017-05-16 17:28:50
server {
root /site/root;
location @cgi {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /site/root/index.php;
}
location / {
try_files $uri @cgi;
}
}