三.组合多个CSS、JavaScript文件的访问请求变成一个请求(ngx_http_concat_module)
2014-10-14 15:58
316 查看
1.该模块类似于apache中的mod_concat模块,用于合并多个文件在一个响应报文中。
默认安装tengine的时候是不安装http_concat_module的,需要重新install一下,还是使用tengine的源代码。
2.进入到/home/jihuan/tengine-2.0.3,执行
$ cd /home/jihuan/tengine-2.0.3
$ ./configure --prefix=/usr/local/tengine --with-http_concat_module
$ sudo make && make install
3.编辑配置文件,关于concat配置可以查看官方文档http://tengine.taobao.org/document_cn/http_concat_cn.html
$ vi /usr/local/tengine/conf/nginx.conf
location / {
concat on; #开启concat模块
concat_max_files 30; #最大能接受的文件数量
root /root/html;
index index.html index.htm index.php;
}
4.重启
$ /usr/local/tengine/sbin/nginx -s reload
5.使用(请求参数需要用两个问号'??')
<script type="text/javascript" src="??js/jquery.js,js/slide_original.js,count/count/count.js"></script>
6.语法说明
/configure [--with-http_concat_module | --with-http_concat_module=shared]
--with-http_concat_module选项,concat模块将被静态编译到tengine中
--with-http_concat_module=shared,concat模块将被编译成动态文件,采用动态模块的方式添加到tengine中
如果是-with-http_concat_module=shared的话,会在tengine的modules目录里生成一个.so文件,需要在nginx的nginx.conf配置文件里加入
dso{
load ngx_http_push_module.so; #我原来的一个shared模块
load 你的so文件;
}
关于tengine的dso动态加载的配置可以参考官方的文档http://tengine.taobao.org/document_cn/dso_cn.html
默认安装tengine的时候是不安装http_concat_module的,需要重新install一下,还是使用tengine的源代码。
2.进入到/home/jihuan/tengine-2.0.3,执行
$ cd /home/jihuan/tengine-2.0.3
$ ./configure --prefix=/usr/local/tengine --with-http_concat_module
$ sudo make && make install
3.编辑配置文件,关于concat配置可以查看官方文档http://tengine.taobao.org/document_cn/http_concat_cn.html
$ vi /usr/local/tengine/conf/nginx.conf
location / {
concat on; #开启concat模块
concat_max_files 30; #最大能接受的文件数量
root /root/html;
index index.html index.htm index.php;
}
4.重启
$ /usr/local/tengine/sbin/nginx -s reload
5.使用(请求参数需要用两个问号'??')
<script type="text/javascript" src="??js/jquery.js,js/slide_original.js,count/count/count.js"></script>
6.语法说明
/configure [--with-http_concat_module | --with-http_concat_module=shared]
--with-http_concat_module选项,concat模块将被静态编译到tengine中
--with-http_concat_module=shared,concat模块将被编译成动态文件,采用动态模块的方式添加到tengine中
如果是-with-http_concat_module=shared的话,会在tengine的modules目录里生成一个.so文件,需要在nginx的nginx.conf配置文件里加入
dso{
load ngx_http_push_module.so; #我原来的一个shared模块
load 你的so文件;
}
关于tengine的dso动态加载的配置可以参考官方的文档http://tengine.taobao.org/document_cn/dso_cn.html
相关文章推荐
- IIS7的集成模式下如何让自定义的HttpModule不处理静态文件(.html .css .js .jpeg等)请求
- 关于HttpModule中像图片,*.css,*.js等资源文件也被请求问题的解决
- 关于HttpModule中像图片,*.css,*.js等资源文件也被请求问题的解决
- http以post方式上传一个文件,构造其请求头和消息报文(转载)
- nginx js、css多个请求合并为一个请求(concat模块)
- Nginx 模块之 ngx_http_limit_req_module 请求处理模块用法
- nginx js、css多个请求合并为一个请求(concat模块)
- nginx访问控制allow、deny(ngx_http_access_module)
- 请求服务器上面的一个文件,需要用户名和密码才能访问
- 将Javascript 和 CSS 写进一个文件
- nginx 的第三方模块ngx_http_accesskey_module 来实现下载文件的防盗链步骤(linux系统下)
- nginx js、css多个请求合并为一个请求(concat模块)
- Nginx模块 ngx_http_limit_req_module 限制请求速率
- 跨域文件crossdomain.xml在weblogic上的部署和http://10.165.26.151:7001/xx.xml可以访问一个文件
- linux 上源码安装Nginx (concat模块) js、css多个请求合并为一个请求
- ngx_http_concat_module
- nginx js、css多个请求合并为一个请求(concat模块)
- SharePoint 2013部署自定义HttpModule访问SPContext.Current的一个问题
- nginx js、css多个请求合并为一个请求(concat模块)
- Tengine-2.1.1 ngx_http_concat_module 400问题