THINKPHP5配置NGINX的坑

TP5最新的框架,需要把站点根目录配置到public,跨站访问需要注意啊

直接上代码吧:

server {

listen 80;
server_name qingxinzui.com;
root /web/qingxinzui.com/public/;
location / {

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

fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;

}
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注