Skip to content

Instantly share code, notes, and snippets.

@isecret
Created October 16, 2017 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isecret/038a34ff9130ce0e13b65bb41fffcedb to your computer and use it in GitHub Desktop.
Save isecret/038a34ff9130ce0e13b65bb41fffcedb to your computer and use it in GitHub Desktop.
ThinkPHP5 Nginx Pathinfo 配置
location / {
   if (!-e $request_filename) {
        rewrite  ^(.*)$    /index.php?s=/$1  last;
        break;
    }
}

location ~ [^/]\.php(/|$) {
    // 省略代码...
    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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment