lnmp 支持THINKPHP设置方法

1.修改php.ini文件支持pathinfo模式

php配置文件:/usr/local/php/etc/php.ini

找到:cgi.fix_pathinfo=0
更改为:cgi.fix_pathinfo=1

重启nginx:

/root/lnmp restart

2.修改对应需要支持网站vhost文件:

地址:/usr/local/nginx/conf/vhost/

原文件 这块注释或删除掉:

#location ~ .*\.(php|php5)?$
		#	{
		#		try_files $uri =404;
		#		fastcgi_pass  unix:/tmp/php-cgi.sock;
		#		fastcgi_index index.php;
		#		include fcgi.conf;
		#	}

替换为:

location ~ \.php {  
                    #fastcgi_pass 127.0.0.1:9000;   
                    #fastcgi_pass unix:/dev/shm/php-cgi.sock;   
                    fastcgi_pass  unix:/tmp/php-cgi.sock;  
                    fastcgi_index index.php;  
                    include fastcgi.conf;  
                    set $real_script_name $fastcgi_script_name;  
                    if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {  
                    set $real_script_name $1;  
                    set $path_info $2;  
                }  
                    fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;  
                    fastcgi_param SCRIPT_NAME $real_script_name;  
                    fastcgi_param PATH_INFO $path_info;  
                }  	
		location / {  
					if (!-e $request_filename){  
					rewrite ^/(.*)$ /index.php?s=/$1 last;  
        }  
    }  

保存后测试正确性:

/usr/local/nginx/sbin/nginx -t

平滑重启nginx:

/usr/local/nginx/sbin/nginx -s reload