Nginx Configuration thinkphp Rewrite

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.