tp5项目部署centos7 解决pathinfo路径
将项目部署到远程服务器上以后,无法以pathinfo访问,此时需要配置一下nginx的配置文件(/etc/nginx/conf.d/default.conf),配置如下:
location / {
root /usr/share/nginx/html;
index index.html index.html;
if (!-e $request_filename) {
rewrite ^/dry/public/(.*)$ /dry/public/index.php?s=$1 last;
}
}

location ~ \.php {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


本文介绍如何解决ThinkPHP5在CentOS7环境下使用PathInfo访问的问题。通过配置Nginx服务器,使得项目能够正常运行。具体步骤包括修改Nginx配置文件中的location指令,确保正确地转发请求到PHP处理程序。
558

被折叠的 条评论
为什么被折叠?



