caching - Nginx not serving updatd files -
on clients updates not getting reflected.
/etc/nginx/nginx.conf
user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # basic settings ## sendfile off; expires off; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # ssl settings ## ssl_protocols tlsv1 tlsv1.1 tlsv1.2; # dropping sslv3, ref: poodle ssl_prefer_server_ciphers on; ## # logging settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # gzip settings ## gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon; ## # nginx-naxsi config ## # uncomment if installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # nginx-passenger config ## # uncomment if installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # virtual host configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } #mail { # # see sample authentication script at: # # http://wiki.nginx.org/imapauthenticatewithapachephpscript # # # auth_http localhost/auth.php; # # pop3_capabilities "top" "user"; # # imap_capabilities "imap4rev1" "uidplus"; # # server { # listen localhost:110; # protocol pop3; # proxy on; # } # # server { # listen localhost:143; # protocol imap; # proxy on; # } #}
/etc/nginx/sites-enabled/default
# may add here # server { # ... # } # statements each of virtual hosts file ## # should @ following url's in order grasp solid understanding # of nginx configuration files in order unleash power of nginx. # http://wiki.nginx.org/pitfalls # http://wiki.nginx.org/quickstart # http://wiki.nginx.org/configuration # # generally, want move file somewhere, , start clean # file keep around reference. or disable in sites-enabled. # # please see /usr/share/doc/nginx-doc/examples/ more detailed examples. ## server { listen 80 default_server; listen [::]:80 default_server; listen 443 ssl; ssl_certificate /etc/nginx/ssl/app.morph.ai/fullchain.pem; ssl_certificate_key /etc/nginx/ssl/app.morph.ai/privkey.pem; root /var/www/html; index index.html index.htm; # make site accessible http://localhost/ server_name _; location / { # first attempt serve request file, # directory, fall displaying 404. try_files $uri $uri/ =404; expires off; add_header cache-control no-cache; # uncomment enable naxsi on location # include /etc/nginx/naxsi.rules } # nginx-naxsi used nginx-naxsi-ui : process denied requests #location /requestdenied { # proxy_pass http://127.0.0.1:8080; #} #error_page 404 /404.html; # redirect server error pages static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root /usr/share/nginx/html; #} # pass php scripts fastcgi server listening on 127.0.0.1:9000 # #location ~ \.php$ { # fastcgi_split_path_info ^(.+\.php)(/.+)$; # # note: should have "cgi.fix_pathinfo = 0;" in php.ini # # # php5-cgi alone: # fastcgi_pass 127.0.0.1:9000; # # php5-fpm: # fastcgi_pass unix:/var/run/php5-fpm.sock; # fastcgi_index index.php; # include fastcgi_params; #} # deny access .htaccess files, if apache's document root # concurs nginx's 1 # #location ~ /\.ht { # deny all; #} } # virtual host using mix of ip-, name-, , port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # root html; # index index.html index.htm; # # location / { # try_files $uri $uri/ =404; # } #} # https server # #server { # listen 443; # server_name localhost; # # root html; # index index.html index.htm; # # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # # ssl_session_timeout 5m; # # ssl_protocols sslv3 tlsv1 tlsv1.1 tlsv1.2; # ssl_ciphers "high:!anull:!md5 or high:!anull:!md5:!3des"; # ssl_prefer_server_ciphers on; # # location / { # try_files $uri $uri/ =404; # } #}
call headers
response headersaccept-ranges:bytes cache-control:no-cache connection:keep-alive content-length:615972 content-type:application/x-javascript date:thu, 10 nov 2016 15:56:52 gmt etag:"582496c2-96624" last-modified:thu, 10 nov 2016 15:48:18 gmt server:nginx/1.4.6 (ubuntu)
request headers accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 accept-encoding:gzip, deflate, sdch accept-language:en-us,en;q=0.8 cache-control:no-cache connection:keep-alive host:app.morph.ai pragma:no-cache upgrade-insecure-requests:1 user-agent:mozilla/5.0 (macintosh; intel mac os x 10_12_1) applewebkit/537.36 (khtml, gecko) chrome/54.0.2840.71 safari/537.36
other details
trying file curl gives updated file. problem browsers.
also on client new file getting reflected getting following in access logs :
47.31.13.38 - - [10/nov/2016:15:57:33 +0000] "get /main.js http/1.1" 200 615972 "-" "mozilla/5.0 (macintosh; intel mac os x 10_12_1) applewebkit/537.36 (khtml, gecko) chrome/54.0.2840.71 safari/537.36"
and on client changes not getting reflected getting following access logs:
150.242.62.25 - - [10/nov/2016:16:13:03 +0000] "get /main.js http/1.1" 200 67389 "-" "mozilla/5.0 (macintosh; intel mac os x 10_12_1) applewebkit/537.36 (khtml, gecko) chrome/54.0.2840.71 safari/537.36"
.
the original file size 615972
on second host size of content delivered 67389
.
Comments
Post a Comment