thinkphp5 nginx配置

server {
  listen        80;
  server_name   xxxxxxx;
  root          /xxxxx/public;
  index         index.php index.html;
  access_log /mydata/wwwlogs/access_nginx.log combined;
  error_log /mydata/wwwlogs/error_nginx.log;

  location ~ \.php {
    #root /mydata/htdocs/office;
      fastcgi_pass unix:/dev/shm/php-cgi.sock;
      fastcgi_index index.php;
      #http模式禁用上面的 启用下面这个
      #fastcgi_pass 127.0.0.1:9000;
      include   fastcgi.conf;
      set $path_info "";
      set $fastcgi_script_name_new $fastcgi_script_name;
      if ($fastcgi_script_name ~*   "^(.+\.php)(/.+)$"  ) {
        set $fastcgi_script_name_new $1;
        set $path_info $2;
      }
      fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name_new;
      fastcgi_param   SCRIPT_NAME   $fastcgi_script_name_new;
      fastcgi_param   PATH_INFO $path_info;
  }

        location / {
                index index.php index.html index.htm;
                if (!-e  $request_filename){
                         rewrite ^(.*)$ /index.php$1 last;
                }
        }

}
HTTPROOT | 自学PHP | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 石头哥 |微信小程序 |木讯 |备案
Copyright © 1998 - 2016 HTTPROOT.COM. All Rights Reserved httproot.com 版权所有