Server {Listen80; server_name www. funsion.com; Root/www/web/funsion; Index index.PHP; #disable access to PHP files in the app directoryLocation ~* ^/application/.+\.php$ {#The . HTML in this directory is allowed to be accessed because the static HTML cache is also generated under this directory return403; } Location~* ^/application/tpl/.+\.html$ {return403;#disable access to HTML files under the template directory } #prohibit access to files in the thinkphp directoryLocation ~* ^/thinkphp/.+\. (php|tpl|html) $ {return403; } Location/ { #thinkphp Rewrite, except for the static resources specified above, other requests must be judged if(!-E$request _filename) {rewrite^/(. *) $/index.php/$1Last ; }} Location~ \.php ($|/){ #Configuring PHP support path_info for URL rewritingSet$script $uri; Set$path _info""; if($uri~ "^ (. +?\.php) (/.+) $") {Set$script$; Set$path _info$; } Fastcgi_pass127.0.0.1:9000; Fastcgi_index Index.PHP; includefcgi.conf; Fastcgi_param Script_filename$document _root$script; Fastcgi_param Script_name$script; Fastcgi_param Path_info$path _info; } Location~* .+\. (gif|jpg|jpeg|png|bmp|swf) {Expires 7d; } Location~* .+\. (js|CSS) { #Cache one year, each time the file is modified, you need to add a timestamp to the URL, otherwise the cache will be readexpires 1y; } }
Nginx Configuration thinkphp Rewrite