nginx 支持thinkphp5的pathinfo

server {
        
        listen       80;
        server_name  rcd.chongjilili.com;
        
        #sendfile on;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /home/lili/project/recommend/ll_newscms;
            index  index.html index.htm index.php ;
            if ( -f $request_filename) {
               break;
            }
            if ( !-e $request_filename) {
                rewrite ^(.*)$ /index.php/$1 last;
                break;
            }
        }
 
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

         
        location ~ .+\.php($|/) {
            root           /home/lili/project/recommend/ll_newscms; 
            fastcgi_pass   127.0.0.1:9000;
            
            set $script $uri;
            set $path_info "";
            if ($uri ~ "^(.+\.php)(/.+)") {
                set $script $1;
                set $path_info $2;
            }
            fastcgi_index    index.php?IF_REWRITE=1;
            fastcgi_param    PATH_INFO    $path_info;   
            fastcgi_param    SCRIPT_NAME    $script;

	    fastcgi_buffer_size 128k;
	    fastcgi_buffers 8 128k;
            #fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章