ngnix.conf
events { worker_connections 1024; }
http{
include mime.types;
default_type application/octet-stream;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 6;
gzip_types application/octet-stream text/javascript application/font-woff text/plain text/css application/javascript image/jpeg image/gif image/png application/xhtml+xml application/xml;
gzip_vary on;
server_tokens off;
upstream nodejs {
server 127.0.0.1:100000;
keepalive 64;
}
server {
server_name www.lizc.me lizc.me;
listen 80;
access_log ./www/access.log;
location ~ .*.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|woff|woff2|swf)$ {
root /node-blog/public/;
access_log off;
expires 0;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header Connection "";
proxy_pass http://nodejs;
}
}
}
以http:// lizc .me/请求页面,火狐显示的结果
以http:// www.lizc .me 请求页面,火狐显示的结果
以http:// 45.32.90 .159/ 请求页面,火狐显示的结果
问题
为什么“http:// www.lizc .me”这个请求的静态文件没有被压缩呢?
感谢
在这里先谢谢大家的回答,非常感谢!