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;
    }
}

 

转载于:https://www.cnblogs.com/open-i/p/6768758.html

你可能感兴趣的:(thinkphp5 nginx配置文件)