Nginx Open PathInfo Support thinkphp Framework Instance

Source: Internet
Author: User

Thinkphp supports the use of pathinfo and URL rewrite to provide a friendly URL, just set the ' Url_model ' + 2 in the configuration file. Under Apache only need to open mod_rewrite module can be normal access, but nginx default is not support PathInfo, so nginx by default is not support thinkphp. However, we can modify the Nginx configuration file to support thinkphp.

Virtual Host configuration file: nginx/conf/vhost/127.0.0.1_8090.conf

server {listen8090;server_name127.0.0.1:8090;access_loglogs/127.0.0.1_8090.access.log  main;    Location/{        root          /www/jingchang/jck;if (!-e $request _filename) {    rewrite  ^/(. *) $  /index.php/$1 Last  ;            break;    }} Location ~ \.php {        root         /www/jingchang/jck;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include Fastcgi.conf;set $real _script_name $fastcgi _script_name;if ($fastcgi _script_name ~ "^ (. +?\.php) (/.+) $") {    set $ Real_script_name $;    Set $path _info;} Fastcgi_param script_filename $document _root$real_script_name;fastcgi_param script_name $real _script_name;fastcgi_ param path_info $path _info;}}

Nginx Open PathInfo Support thinkphp Framework Instance

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.