thinkphp5在nginx下的conf配置文件以支持url路由

server {
    listen       80;
    server_name  wx.hongxuelin.com;
    index index.html index.htm index.php;
    root /var/www/root/wx.hongxuelin.com/public/;
    set  $root  /var/www/root/wx.hongxuelin.com/public;

    
    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_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 /usr/local/nginx/conf/fastcgi.conf;
        fastcgi_pass 127.0.0.1:9000;
    }

    access_log logs/wx_access.log;
    error_log logs/wx_error.log;
}
添加新评论