nginx thinphp 404

server
	{
		listen 80;
		#listen [::]:80;
		server_name  demo.tpshop3.com localhost;
		index index.html index.htm index.php default.html default.htm default.php;
		root  /home/wwwroot/TPshop_v1.0;
		#include phpcms.conf;
		#error_page   404   /404.html;


			location / { 
			  if (!-e $request_filename) {
				rewrite  ^(.*)$  /index.php?s=$1  last;
				break;
			 }
			}

            location ~ .php($|/) {
			
				set $script $uri;
				set $path_info "";

				if ($uri ~ "^(.+.php)(/.+)") {
					set $script $1;
					set $path_info $2;
				}

				fastcgi_param SCRIPT_FILENAME $document_root$script;
				fastcgi_param SCRIPT_NAME $script;
				fastcgi_param PATH_INFO $path_info;
 
				try_files $uri =404;
				fastcgi_pass  unix:/tmp/php-cgi.sock;
				fastcgi_index index.php;
				include fastcgi.conf;
#				fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;


			}
			#error_page 404 = /404.php;

		location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
			{
				expires      30d;
			}

		location ~ .*\.(js|css)?$
			{
				expires      12h;
			}

		#access_log off;
                access_log  /home/wwwlogs/tpshop.com.log  access;
		error_page 404 /404.php;




	}


猜你喜欢

转载自blog.csdn.net/lovetina2017/article/details/80049498
今日推荐