问题描述:thinkphp5框架下的项目apache服务器环境开发上线至nginx服务器环境遇到的一些问题:
1:如果设置的是网站根目录可以直接如下操作比如我的网站在nginx.conf中root设置如下
root /home/wwwroot/default/class_schedule/public;
把入口文件所在文件夹作为网站根目录
参考thinkphp开发手册
进行配置,
之前设置的方法中的index.php写错了,导致下面
中的内容无法生效,用#屏蔽后完成index.php的隐藏
2:二级目录
参考手册
例如我的
将上面的内容修改如下
root /home/wwwroot/default/;
location /class_schedule/public/ {
# index index.php;
#try_files $uri @rewriteapp;
if (!-e $request_filename) {
rewrite ^/class_schedule/public/(.*)$ /class_schedule/public/index.php?s=/$1 last;
break;
}
}
在配置某些属性时重复配置会覆盖,产生问题