直接修改 nginx的配置文件
01 | # 典型配置 |
02 | location ~ \.php$ { |
03 | root html; |
04 | fastcgi_pass 127.0.0.1:9000; |
05 | fastcgi_index index.php; |
06 | fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT $fastcgi_script_name ; |
07 | include fastcgi_params; |
08 | } |
09 |
10 | # 修改第1,6行,支持 pathinfo |
11 |
12 | location ~ \.php(.*)$ { # 正则匹配.php后的 pathinfo 部分 |
13 | root html; |
14 | fastcgi_pass 127.0.0.1:9000; |
15 | fastcgi_index index.php; |
16 | fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT $fastcgi_script_name ; |
17 | fastcgi_param PATH_INFO $1 ; # 把 pathinfo 部分赋给PATH_INFO变量 |
18 | include fastcgi_params; |
19 | } |
0则评论给“让nginx支持 pathinfo”