Nginx不提供更新的文件

时间:2014-12-30 10:49:46

标签: nginx configuration

我已经在生产中配置nginx来服务我们的网站应用程序,它一直工作到今天。我推送的最后更新是一个月前,今天我推送更新的代码并重新启动nginx但是nginx仍然提供旧文件而不是更新的文件。

来自nginx.conf的配置

user root;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http{
    sendfile off;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    expires off;
    open_file_cache off;
    gzip on;
    gzip_disable "msie6";
    server{
       listen 80;
       server_name  ****.****.com;
       root /etc/nginx/www/app/public/;
       include www/app/proxy.conf;
    }
    include www/app/staticserver.conf;
 }

proxy.conf

location /api/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass http://10.0.3.2:3003;
    proxy_redirect  off;
    access_log app;
}

location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass http://10.0.3.2:3003;
    proxy_redirect  off;
    access_log app;
}

location /socket.io/ {
proxy_pass http://10.0.3.2:3003;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
 #js and html
location ~* ^.+\.(js)$ {
    proxy_pass http://10.0.3.2:8197;
}
#css and image and Fonts.. etc..
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|flv|swf|woff|eot|ttf|svg|html|htm|less)$ {
    proxy_pass http://10.0.3.2:8198;
}

staticserver.conf

#For serve java script files
server {
    listen 8197;
    server_name  10.0.3.2;
    location / {
        root /etc/nginx/www/app/public;
        access_log app_js;
    }

    #error_page  404 /404.html;
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}
#For serve css | less | images |fonts..
server {
    listen 8198;
    server_name 10.0.3.2;

    location / {
        root /etc/nginx/www/app/public/;
        access_log app_others;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

设置sendfile off;对我不起作用,我应该采取任何其他配置来阻止nginx提供旧文件。 我也尝试过清除浏览器缓存,但没有用。

0 个答案:

没有答案