Nginx似乎显示旧版网站

时间:2015-09-16 21:42:25

标签: tomcat caching amazon-web-services nginx

最近遇到了一个非常奇怪的问题。我们使用Amazon CodeDeploy将我们的Java应用程序部署到后端Web服务器。它工作正常一段时间然后注意到我们的网站一直显示旧版本(不是最新的代码)。

经过几个小时的AWS来回,我们了解到CodeDeploy很好并按预期工作。那问题是什么?

我设法检查了tomcat并看到我们的更改已正确部署到tomcat而没有任何错误。唯一剩下的东西......我们的负载均衡器(Nginx)。

我在虚拟主机文件

中设置了 expires off ;

我还在nginx.conf文件中设置了 sendfile off;

此时,我几乎不知所措,不知道还有什么可以尝试......

非常感谢任何帮助。

澄清: 我正在使用Elastic Nginx(https://github.com/rochacon/elastic-nginx),它负责在任何后端webapp服务器出现故障时保持Nginx内部的上游(IP)更新。我检查过上游并看到每个webapp服务器有2个条目,所以看起来没问题。

Nginx配置:

  

nginx版本:nginx / 1.6.2由gcc 4.8.2 20140120构建(Red Hat   4.8.2-16)(GCC)启用TLS SNI支持配置参数: - 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 = / var / run /nginx.pid --lock-path = / var / 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_ads_module --with-http_xmagelt_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_modul e --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-google_perftools_module --with-debug --with-cc-opt =' -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE = 2 -fexceptions -fstack-protector -param = ssp-buffer-size = 4 -m64 -mtune = generic'--with-ld-opt ='-Wl ,-E'

Nginx.conf

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;

    # server_names_hash_bucket_size 64;
    # 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/*;

   #upstream backend {
   #    server 128.199.57.231;
   #    server 104.236.50.190;
   #    server 10.0.0.3:80;
   #}
   #server {
   #        listen 80;
   #location / {
   #            proxy_pass http://backend;
   #        }
   #    }

    }

0 个答案:

没有答案