当前位置:Gxlcms > PHP教程 > CI在ubuntunginx下访问出现404的疑惑

CI在ubuntunginx下访问出现404的疑惑

时间:2021-07-01 10:21:17 帮助过:8人阅读

这种目录结构 在nginx为什么不能访问到admin.php ?
报错404
请教下

nginx配置如下 :


也是过以下的配置,还是404,很无语。ci没有设置path_info 也没有写其他路由。很奇怪,求指点


回复讨论(解决方案)

你 php 的根没有声明吧

你 php 的根没有声明吧

你指的是nginx指定的主目录吗?这指定了的

解决方案:
location /index.php {
index index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?$1 last;
break;
}
}
location /admin.php {
index admin.php;
if (!-e $request_filename) {
rewrite . /admin.php?$1 last;
break;
}
}
新增了2个location 但是首页index.php省略又做不了了。很是郁闷 ci对rewrite依赖太大

人气教程排行