1 sudo cd/etc/nginx/; 2 sudo vi fastcgi_params;
1.URL rewrite
If your URL parameter is not passed with a. XXX, but is customized, such as with the/xx/xx/xx way, then the Nginx will open PathInfo
Typical configuration:
1 location ~ \. php$ {2 root html; 3 Fastcgi_pass 127.0.0.1:9000; 4 Fastcgi_index index. PHP; 5 Fastcgi_param script_filename $DOCUMENT _root$fastcgi_script_name; 6 include Fastcgi_params; 7 }
Modify 1, 62 lines, support PathInfo
1Location ~ \.php (. *) $ {#regular match. PathInfo section after PHP2 root html;3Fastcgi_pass 127.0.0.1:9000;4Fastcgi_index index.php;5Fastcgi_param Script_filename$DOCUMENT _root$fastcgi_script_name;6Fastcgi_param Path_info $;#assign the PathInfo part to the PATH_INFO variable7 includeFastcgi_params;8}
2. When the URL is rewritten, such as access to xxx/index.php/xxx/xxx will be blank, and access is normal.
A. Modifying the Fastcgi_params file
sudo cd/etc/nginx/; sudo vi fastcgi_params;
Configuration file Contents:
$document _root$fastcgi_script_name; #这行没有就添加, you can change it.
B. Modifying the Nginx configuration file
Location ~. php$ { root html; Fastcgi_pass 127.0.0.1:9000; Fastcgi_index index. php; Fastcgi_param $document _root$fastcgi_script_name# New
include # New
}
3. Hide the entry file
A. If the code is in the root directory that the domain name points to, then
// ... omit part of the code if $request _filename ) { rewrite ^ (. *) $ /index.php?s=$1 last ; Break ; }}
B. If the code is under a subordinate directory that the domain name points to, then
#youdomain is the name of the directory in which it resides. For example, the domain name root directory for the/var/www/html code is/var/www/html/wave/project, where Youdomain is replaced by wave/projetc
location/youdomain/ { if$request _filename) { rewrite ^/youdomain/(. *) $ /youdomain/index.php?s=$1 last ; } }
===
Log Nginx and PHP after installation of the URL rewrite, access to the blank and hidden index.php file operation method