顯示網站最新版本的奇怪 Nginx 問題

顯示網站最新版本的奇怪 Nginx 問題

我們正在運行 Nginx 1.6.2 並與後端伺服器一起設定為負載平衡器(使用代理)。前幾天注意到,當我在後端伺服器上進行更新時,Web 前端看不到所做的更改。它繼續顯示舊版本。

我們做過的事:

  1. 我們測試過全部瀏覽器會出現相同的結果。
  2. 升級到 Nginx 1.9.4 - 仍然沒有解決問題
  3. 我甚至將 Cache-Control 設為 no-cache,以嘗試排除快取問題。我確實在開發人員工具中註意到,如果我檢查相關文件 - 修改日期顯示舊日期,它不會顯示它們實際更新的時間。
  4. 清除位於 /var/lib/nginx/tmp/proxy/ 的文件

此外,我們正在討論的具體文件是.css.js文件

最後,如果我們直接連接到 Web 後端之一,它就可以完美運作!這就是為什麼我們認為它與 Nginx 有關)。

對此的任何建議或建議將不勝感激。

js 檔案的回應頭:

Response headers:
Connection:keep-alive
Content-Length:33365
Content-Type:application/javascript
Date:Fri, 25 Sep 2015 13:07:58 GMT
Last-Modified:Sat, 08 Aug 2015 17:56:52 GMT
Server:nginx/1.9.4
Strict-Transport-Security:max-age=31536000

Request headers
Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Cookie:__utmt=1; JSESSIONID=18CB152C40CC7C3A9C8C2058BC9ABA1C;      __utma=129083286.1723352187.1441183278.1443165488.1443186453.22; __utmb=129083286.2.10.1443186453; __utmc=129083286; __utmz=129083286.1442402128.17.2.utmcsr=console.aws.amazon.com|utmccn=(referral)|utmcmd=referral|utmcct=/support/chat
Host:ourdomain.com
Pragma:no-cache
Referer:https://ourdomain.com/dashboard/adminDashboard
User-Agent:Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.122 Mobile Safari/537.36

.css 檔案的回應標頭

Connection:keep-alive
Content-Length:31125
Content-Type:text/css
Date:Fri, 25 Sep 2015 13:07:57 GMT
Last-Modified:Thu, 27 Aug 2015 08:44:24 GMT
Server:nginx/1.9.4
Strict-Transport-Security:max-age=31536000

Nginx 設定

user nginx;
worker_processes 22;
pid /var/run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
    # Basic Settings
        ##

    sendfile off;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        client_max_body_size 15M;
        # server_tokens off;

 proxy_headers_hash_max_size 51200;
        proxy_headers_hash_bucket_size 6400;
#         server_names_hash_bucket_size 6400;
        # server_name_in_redirect off;

#        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
    # 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/x-javascript text/xml application/xml application/xml+rss text/javascript;

        ##
    # nginx-naxsi config
        ##
    # Uncomment it if you installed nginx-naxsi
        ##
        #include /etc/nginx/naxsi_core.rules;

        ##
    # nginx-passenger config
        ##
    # Uncomment it if you 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/*;
       # include /etc/nginx/sites-available/*;

#upstream backend {
#    server 128.199.57.230;
#    server 104.236.50.191;
#    server 10.0.0.3:80;
#}
#server {
#        listen 80;
#location / {
#            proxy_pass http://backend;
#        }

相關內容