Windows modify Nginx pathinfo support, thinkphp hidden in nginx environment index.php

Source: Internet
Author: User

The first time you install Nginx, the installation is complete and the thinkphp is found to be unable to run. After consulting the relevant information, it is resolved by the following methods:

Configure Nginx PathInfo Support:

After the original configuration is complete:

#location ~ \.php$ {

# root E:/www;

# Fastcgi_pass 127.0.0.1:9000;

# Fastcgi_index index.php;

# Fastcgi_param Script_filename E:/www$fastcgi_script_name; # Fastcgi_param Path_info E:/www$fastcgi_script_name;

# include Fastcgi_params;

#}

Increase the configuration results after PathInfo:

Location ~ \.php ($|/) {roote:/www; set $script $uri; set $path _info ""; if ($uri ~ "^ (. +\.php) (/.+)") {set $script $; set $path _info $} fastcgi_pass 127.0.0.1:9000; Include Fastcgi_params; Fastcgi_param path_info $path _info; Fastcgi_param Script_filename E:/www$script; Fastcgi_param Script_name $script; }

Add thinkphp Hide index.php support:
If the entry file is in a subdirectory:
Location/{
Root e:/www;
Index index.html index.php index.htm;
if (!-e $request _filename) {
Rewrite ^/subdirectory/(. *) $/subdirectory/index.php?s=$1 last;
Break
}
}
If the portal file is in the Web directory:
Location/{
Root e:/www;
Index index.html index.php index.htm;
if (!-e $request _filename) {
Rewrite ^ (. *) $/index.php?s=$1 last;
Break
}
}

Finish the call.


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.