标签归档:thinkphp

Nginx对新版本PHP7.0.11关于PATH_INFO问题的修正

从这个版本以后,使用下面的配置使得Nginx支持ThinkPHP

server {
	listen		80;
	server_name	xxx.dev.onlyke.com;
	index		index.html index.htm index.php;
	root		/home/nginx/xxx;
	
	location ~ .*\.(gif|jpg|jpeg|png|bmp|ico|webp)$
	{
		expires 30d;
	}
	location ~ .*\.(woff|ttf|svg|otf|eot)$
	{
		expires 180d;
	}
	location ~ .*\.(js|css)?$
	{
		expires 12h;
	}
	location /
	{
		if (!-e $request_filename) { 
			rewrite ^(.*)$ /index.php/$1 last;
			break;
		}
	}
	location ~ \.php($|/)
	{
		fastcgi_pass unix:/run/php/php7.0-fpm.sock;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		fastcgi_param PATH_INFO $fastcgi_script_name;
		include	fastcgi_params;
	}
}