关于nginx 配置gzip 压缩js问题 请求合并问题
2016-03-07 17:55
721 查看
gzip on; gzip_min_length 1k; gzip_buffers 16 64k; gzip_http_version 1.1; gzip_comp_level 9; gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary on;
只是打开 gzip on 和gzip——types 本人在centos系统下对js不能有效压缩,要加上最后的gzip_vary才能压缩js
隐藏版本号
在nginx配置文件的http标签内加入“server_tokens off; ”参数,也可以放大server标签和location标签中或者在源代码中更改src/core/nginx.h安装nginx concat
12345678910 | # cd /usr/local/src/# wget http://nginx.org/download/nginx-1.4.2.tar.gz# wget https://github.com/alibaba/nginx-http-concat/archive/master.zip -O nginx-http-concat-master.zip# unzip nginx-http-concat-master.zip# tar -xzvf nginx-1.4.2.tar.gz# cd nginx-1.4.2# ./configure --prefix=/usr/local/nginx-1.4.2 --with-http_stub_status_module \--add-module=../nginx-http-concat-master# make# make install |
配置nginx
123456789101112 | server { listen 80; server_name www.ttlsa.com; root /data/site/www.ttlsa.com; location /static/ { concat on; concat_max_files 20; concat_unique off; }} |
URL访问控制来就应该只是资源文件,禁止指定扩展名程序被执行,例如:.php,.sh,.pl,nginx下禁止访问资源目录下的php程序文件
相关文章推荐
- nginx安装
- 安装windows 下 php7+nginx+fastcgi
- Mac OS X 10.10 配置 nginx + php
- nginx日志切割
- centos 6.6 Nginx 安装配置(已纠正)
- 【nginx】4xx,5xx 保持自定义header
- 【nginx】4xx,5xx 保持自定义header
- LVS Nginx HAProxy
- nginx密码认证
- Nginx VS HaProxy
- nginx(四)fastcgi相关配置
- tony_nginx_02_URL重写
- Apache与Nginx服务器对比
- nginx实例解析
- 关于什么是nginx配置文件下的location
- Windows下配置Nginx+PHP
- [转] ubuntu+php+nginx 安装
- apache,nginx.iis 从写规则转换
- 【Nginx】事件和连接
- nginx mod_zip