thinkphp5 nginx配置文件

LNMP下thinkphp5 nginx的解析配置   经测试php5.4-5.6都可成功运行

nginx version: nginx/1.11.5

 

server {
    listen 80;
    server_name    jq.cn;
    access_log    /app/logs/nginx/access.log;
    error_log    /app/logs/nginx/error.log;
    set        $root    /webapp/demo;
    location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
    {
        root $root;
    }
    location / {
        root    $root;
        index    index.html index.php;
        if ( -f $request_filename) {
            break;
        }
        if ( !-e $request_filename) {
            rewrite ^(.*)$ /index.php/$1 last;
            break;
        }
    }
    location ~ .+\.php($|/) {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param    SCRIPT_FILENAME    $root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

 

posted @ 2017-04-26 15:14  茶觉  阅读(150)  评论(0编辑  收藏  举报