奇怪的 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;
#        }

相关内容