Environment centos6, nginx1.6.2, code location: [nginxpath]/conf.d/default.conf
<code>server { listen <span>80</span>; server_name _; root /<span>var</span>/www/html/; <span>#access_log logs/host.access.log main;</span> location / { index index.html index.php index.htm; <span>if</span> (-e <span>$request_filename</span>) { <span>break</span>; } <span>if</span> (!-e <span>$request_filename</span>) { <span>#rewrite 规则填写位置</span> rewrite ^/(.*)$ /index.php/$<span>1</span> last; <span>break</span>; } } error_page <span>404</span> /<span>404.</span>html; location = /<span>404.</span>html { root /<span>var</span>/www/error; } error_page <span>500</span><span>502</span><span>503</span><span>504</span> /<span>50</span>x.html; location = /<span>50</span>x.html { root /<span>var</span>/www/error; } location ~ ^.+.php($|/) { fastcgi_pass <span>127.0</span><span>.0</span><span>.1</span>:<span>9000</span>; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME <span>$document_root</span><span>$fastcgi_script_name</span>; fastcgi_param SCRIPT_NAME <span>$fastcgi_script_name</span>; fastcgi_param PATH_INFO <span>$fastcgi_path_info</span>; fastcgi_param PATH_TRANSLATED <span>$document_root</span><span>$fastcgi_path_info</span>; <span>include</span> fastcgi_params; } } </code>
The above introduces the nginx pathinfo configuration, which is suitable for higher versions of nginx, including pathinfo and nginx content. I hope it will be helpful to friends who are interested in PHP tutorials.