Joke Collection Website - Blessing messages - How to make nginx support the ci framework of php?

How to make nginx support the ci framework of php?

When developing a project through ci framework under nginx, it was found that ci framework could not run under Nginx. After searching for relevant information on the network, nginx can support the PHP ci framework by modifying relevant configurations.

1. Modify the configuration file of ci framework.

Modify the value of $ config【‘uri _ protocol‘'].

Replace with:

$ config【‘uri _ protocol‘】? =? PATH _ INFO‘;

2. Modify the nginx configuration file and add the following code in the server section:

Location? /index.php{

fastcgi _ pass UNIX:/tmp/PHP-CGI . sock;

fastcgi_param? Script _ file name? /home/wwwroot/index . PHP;

fastcgi_param? Path information? $ fastcgi _ path _ info

fastcgi_split_path_info? ^(.+\.php)(。 *)$;

fastcgi_param? Path _ translated? $ document _ root $ fastcgi _ path _ info;

Including? fcgi.conf

}

If there are multiple applications (such as background applications), you can add multiple pieces of code and modify the corresponding entry files:

Location? /admin.php{

fastcgi _ pass UNIX:/tmp/PHP-CGI . sock;

fastcgi_param? Script _ file name? /home/wwwroot/admin . PHP;

fastcgi_param? Path information? $ fastcgi _ path _ info

fastcgi_split_path_info? ^(.+\.php)(。 *)$;

fastcgi_param? Path _ translated? $ document _ root $ fastcgi _ path _ info;

Including? fcgi.conf

}