用户
 找回密码
 入住 CI 中国社区
搜索
查看: 7667|回复: 4
收起左侧

[服务器] 我该如何修改nginx.conf使得可以适配使用CI框架?

[复制链接]
发表于 2018-1-18 21:17:04 | 显示全部楼层 |阅读模式
本帖最后由 ciicy 于 2018-1-18 21:17 编辑

运行环境:centos 7.2
如下是现在已经写好的配置文件内容,但是只能访问默认控制器welcome的index方法,其他的一律都无法访问。内容如下(直接放代码会格式混乱,所以我就写到了文档里,见附件)。 nginx.zip (1.6 KB, 下载次数: 8)
发表于 2018-1-24 16:19:30 | 显示全部楼层
-------- nginx.conf 配置例子如下: -----------------------------------------

                location / {
                    root   html/xxx;
                    index  index.php index.html index.htm;

                        if (!-e $request_filename) {
                          rewrite ^/(.*)$ /index.php?$1 last;
                          break;
                        }     
                 }


-------- .htaccess 文件内容(web根目录下): -----------------------------------------

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

本版积分规则