restful - How does nginx tell that the request is a dynamic request without a .php match?
黄舟
黄舟 2017-05-16 17:26:50
0
2
879

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?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
phpcn_u1582
location /  
{  
    index index.php;  
    # 重写到index  
    if ($request_filename !~ (js|css|images|robots/.txt|index/.php.*) ) {  
        rewrite ^/(.*)$ /index.php/ last;  
        break;  
    }  
} 
滿天的星座
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;
    }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template