Overview
Today encountered a problem, ubuntu+nginx+mysql configuration thinkphp project, did half found, Nginx not support thinkphp path_info mode, Baidu for a long time, in a friend's help to solve, record.
Nginx supports Thinkphp's path_info
Environment
Ubuntu 14.04+nginx+mysql. All programs are installed through Apt-get, so the Nginx configuration file path is/etc/nginx/sites-available/default.
Solving method
Navigate to the following sections of the Nginx configuration file:
Copy Code code as follows:
Location/{
# Attempt to serve request as file, then
# as Directory, then fall back to displaying a 404.
Try_files $uri $uri/= 404;
# Uncomment to enable NAXSI on this location
# Include/etc/nginx/naxsi.rules
}
Add the following code:
Copy Code code as follows:
if (!-e $request _filename)
{
Rewrite ^/myapp/(. *) $/myapp/index.php?s=$1 last;
Break
}
The regular wording of the writing
Solve this problem, see several solutions, light is to see a few, also do not know which is the most standard, I am not very familiar with the first record down, and then slowly study:
Regular 1:
Copy Code code as follows:
Rewrite ^/myapp/(. *) $/myapp/index.php/$1 last;
Regular 2:
Copy Code code as follows:
Rewrite ^ (. *) $/index.php?s=$1 last;