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

让nginx服务器支持CI

[复制链接]
发表于 2008-12-4 15:37:31 | 显示全部楼层 |阅读模式
1.修改配置文件内容:

server {
        listen 80;
        server_name localhost;
        root           /MyWeb/www;
        location / {
         index index.php index.html;
  #把可以访问的目录放到这里
  if ($request_filename !~ (js|css|wowmodel|robots\.txt|index\.php.*) ) {
                 rewrite ^/(.+)$ /index.php last;
  }
        }
        location ~ .*\.(php|php5)?$ {
            fastcgi_pass   127.0.0.1:9000;
            include /MyWeb/nginx/conf/fastcgi_params;
        }
#博客的图片较多,更改较少,将它们在浏览器本地缓存15天,可以提高下次打开我博客的页面加载速度。
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
    expires      5d;
  }
  #博客会加载很多JavaScript、CSS,将它们在浏览器本地缓存1天,访问者在看完一篇文章或一页后,再看另一篇文件或另一页的内容,无需从服务器再次下载相同的JavaScript、CSS,提高了页面显示速度。
  location ~ .*\.(js|css)?$
  {
    expires      1d;
  }
        log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
        access_log  /MyWeb/nginx/logs/access.log  access;
    }



-----------------------------------------万恶的分割线-----------------------------------------------------------------

2.修改config文件:

$config['uri_protocol']  = "REQUEST_URI";


以上做完就可以跑了,嗷嗷快!

[ 本帖最后由 cocely 于 2008-12-4 15:39 编辑 ]
 楼主| 发表于 2008-12-4 16:55:36 | 显示全部楼层
但是有问题了,我因为用的EXT,用ajax调入页面总提示找不到,我直接在浏览器里打方法网址就没问题,望高手指导下
发表于 2008-12-4 17:01:46 | 显示全部楼层
使用绝对 URL 也找不到吗?最好使用绝对 URL。
 楼主| 发表于 2008-12-4 18:01:54 | 显示全部楼层
Hex,不是路径的事。

如:
var center = new Ext.Panel({
                region:'center',
                el:'center',
                id:'centerBody',
                contentEl:'body',
                border:false,
                //frame:true,
                //baseCls:'x-plain', //panel的背景
        margins: '0 5 5 0',  //panel上,右,下,左 边距
                autoLoad:{url:'Home/home/', method:'POST', scripts: true, scope: this}

        });

这里面的autoLoad:{url:'Home/home/', method:'POST', scripts: true, scope: this}有问题

POST改成GET就好了,但是我也不知道什么原因,Ext官方有网友给出的解决办法,也没有说明白到底为什么!
发表于 2008-12-4 18:17:31 | 显示全部楼层
autoLoad:{url:'http://xxx.com/index.php/home/home/', method:'POST', scripts: true, scope: this}
这样不行?

我以前用 ext 没有这些问题,我都是用的绝对路径。
 楼主| 发表于 2008-12-4 18:30:59 | 显示全部楼层
apache,没有问题,主要问题出现在nginx,我发现POST模式情况下post为null的情况下就会出现那样的问题。所以post模式提交不为null的表单的时候没有问题。
 楼主| 发表于 2008-12-4 18:32:58 | 显示全部楼层
A PHP Error was encountered

Severity: Warning

Message: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\MyWeb\www\mangosAdmin\system\application\controllers\getjson.php:105)

Filename: models/menu.php

Line Number: 14

Hex有空帮看下这个错误,apache下没有这个问题,nginx有这个问题了
发表于 2008-12-4 20:08:45 | 显示全部楼层
getjson.php:105 已经输出字符了,检查一下,第 105 行代码。

本版积分规则