Etag: "5d8c72a5edda8d6a: 3239 & Prime;
The query update format of the client is as follows:
If-None-Match: "5d8c72a5edda8d6a: 3239 & Prime;
If ETag does not change, status 304 is returned.
That is, after the client sends a request, the Http Reponse Header contains Etag: "5d8c72a5edda8d6a: 3239 & Prime;
ID, indicating that the Client has the ID: 5d8c72a5edda8d6a: 3239. when the next Request is sent to Request the same URI, the browser sends an If-None-Match header (Http RequestHeader) at the same time. The header contains the Etag: "5d8c72a5edda8d6a: 3239 & Prime; identifier.
If-None-Match: "5d8c72a5edda8d6a: 3239"
In this way, the Client is equal to two copies of the Cache, and the server compares the etag of the two. if-None-Match is False and 200 is Not returned, 304 (Not Modified) Response is returned.
System: centos 5.x
Required software: git nginx-static-etags module package
1. Install git
If you have not installed git on your server, refer to the following two methods to install git in centos.
2. Download the nginx-static-etags module package
Git clone git: // github.com/mikewest/nginx-static-etags.git./nginx-static-etags
3. Compile and install
The code is as follows: |
Copy code |
Cd/root/install/nginx-static-etags Echo ''> ngx_http_static_etags_module.c adds an empty line. Otherwise, an error will be reported during compilation. This is a bug in nginx-static-etags. Cd/root/install/nginx-1.2.x ./Configure -- user = www -- group = www -- add-module = ../ngx_cache_purge-1.3 -- add-module = ../nginx-accesskey-2.0.3 -- Add-module = .. /memc-nginx-module -- add-module = .. /srcache-nginx-module -- add-module = .. /nginx-static-etags/-- prefix =/usr/share/nginx -- Sbin-path =/usr/sbin/nginx -- conf-path =/etc/nginx. conf -- error-log-path =/var/log/nginx/error. log -- Http-log-path =/var/log/nginx/access. log -- http-client-body-temp-path =/var/lib/nginx/tmp/client_body -- Http-proxy-temp-path =/var/lib/nginx/tmp/proxy -- http-fastcgi-temp-path =/var/lib/nginx/tmp/fastcgi -- Pid-path =/var/run/nginx. pid -- lock-path =/var/lock/subsys/nginx -- with-http_secure_link_module -- With-http_random_index_module -- with-http_ssl_module -- with-http_realip_module -- with-http_addition_module -- With-http_sub_module -- with-http_dav_module -- with-http_flv_module -- with-http_gzip_static_module -- With-http_stub_status_module -- with-http_perl_module -- with-http_geoip_module -- with-mail -- With-mail_ssl_module -- with-google_perftools_module -- with-ld-opt =-ltcmalloc_minimal Make Make install |
4. Configure nginx
Vi/etc/nginx. conf
It is best to add it to the server configuration of your VM.
The code is as follows: |
Copy code |
Location ~ . */. (Gif | jpg | jpeg | png | bmp | ico | rar | css | js | zip | xml | txt | flv | swf | mid | doc | cur | xls | pdf | txt |) $ { FileETag on; Etag_format "% X"; www.111cn.net Expires 30d; } |
Verify the nginx restart
Curl -- head http://blog.slogra.com/xx/swfobject.js
You can see that the etag has been identified. The original text is from blog.slogra.com.