CI在ubuntu nginx下访问出现404的疑惑

WBOY
Release: 2016-06-20 12:56:55
Original
1000 people have browsed it

这种目录结构 在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依赖太大

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template