码迷,mamicode.com
首页 > Web开发 > 详细

配置nginx支持thinkphp请求

时间:2015-07-10 16:56:52      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:nginx   thinkphp   nginx支持thinkphp   

直接记录配置如下
user  www;
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    keepalive_timeout  300;
    sendfile        on;
    server {
        listen       80;
        server_name  localhost;
        root /var/www/web;
        index index.php index.html index.htm;
        location / {
            if (-e $request_filename){
                break;
            }
            if (!-e $request_filename){
                rewrite ^/(.*)$ /index.php/$1 last;
                break;
            }
            rewrite ^/$/index.php last;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ \.php {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.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$fastcgi_script_name;
                fastcgi_param SCRIPT_NAME $real_script_name;
                fastcgi_param PATH_INFO $path_info;
                include fastcgi_params;
        }
    }
}


配置nginx支持thinkphp请求

标签:nginx   thinkphp   nginx支持thinkphp   

原文地址:http://quietnight.blog.51cto.com/7163892/1672882

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!