#843 closed enhancement (wontfix)
Add checking modify date in ngx_http_gzip_static_module + variable which indicate which version of file precompressed or original nginx would be using
Reported by: | Mikhail | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | documentation | Version: | 1.8.x |
Keywords: | Cc: | ||
uname -a: | Linux vmi25208.contabo.net 4.2.6-301.fc23.x86_64 #1 SMP Fri Nov 20 22:22:41 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.8.0
built by gcc 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC) built with OpenSSL 1.0.2d-fips 9 Jul 2015 TLS SNI support enabled configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/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 --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-pcre-jit --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' |
Description
http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html#gzip_static
Nginx checking the existence of precompressed files without checking modify date. If .gzip file is older than original resource must used original resource.
I also propose to define variable which indicate which version of file precompressed or original nginx would be using. It needed for purpose automatic minification and compression.
Example:
server {
if ($request_method !~ (GET|POST)$ ) {
return 444;
}
listen 80;
listen [::]:80;
server_name mysite.com;
root /home/mysite/www/minify;
error_log /home/mysite/logs/nginx_error_minify.log;
access_log /home/mysite/logs/nginx_access_minify.log;
#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~* \.(css|js)$ {
expires max;
gzip off;
gzip_static on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/mysite/www/minify/nginx-minification.php;
if (! $used_gzip_static) {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}
}
}
Change History (3)
comment:1 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 9 years ago
But nginx already check for gzipped version exists, what is the difficulty get instead file changing time?
comment:3 by , 9 years ago
It doesn't check if an uncompressed version exist if a client accepts gzip and a compressed version exists. Checking both versions will result in additional unneeded load.
The gzip_static isn't expected to check anything, it merely returns a gzipped version of a file if a client supports gzip and the gzipped version exists. Any checks are expected to be done by external software while preparing files for serving. Adding checks inside nginx will impose additional unneeded load on the system.