1. 程式人生 > >ThinkPHP在lnmp中開啟pathinfo

ThinkPHP在lnmp中開啟pathinfo

1.修改pho.ini

位置:/usr/local/php/etc

找到:cgi.fix_pathinfo=0

更改為:cgi.fix_pathinfo=1

 

2. 修改nginx站點配置檔案

位置:/usr/local/nginx/conf/vhost

將原有的

  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
  }

修改為:

  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;

    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_index index.php;
    include fastcgi.conf;
  }