Re: опаздывание с возвращением обновлений css/javascript файлов

Alexander Moskalenko alexander.moskalenko на gmail.com
Вт Сен 13 14:55:13 UTC 2011


Нужно сначала влить файл под другим именем, а потом переименовать в нужное.
Т.н. атомарное обновление.

2011/9/13 locojohn <nginx-forum at nginx.us>

> Привет!
>
> Проблема следующая, которая возникает
> периодически, без очевидной связи. Я
> обновляю статический CSS или JS файл по FTP.
> Делаю рефреш в браузере. Браузер "не
> видит" обновления, потому что сервер
> возвращает 304 Not Modified. Через некоторое
> время (от секунды до минуты и даже
> больше), после нескольких рефрешев,
> наконец возвращается 200 OK и код
> обновляется.  Использовались браузеры:
> Safari 5.1 (Mac OS X), Firefox 6.0.2 (Win 7), Chrome 13.0.782.220 m (Win
> 7)
>
> Пробовал выносить css/javascript из gzip_types, но
> это не изменило ситуации.  Откатывался
> на nginx/1.0.5, но это не помогло.  В общем,
> обновления видятся через какое-то
> неопределённое время, но не сразу.
>
> Дорогие коллеги, с чем это может быть
> связано и как решить данную проблему?
>
> nginx -V :
>
> nginx: nginx version: nginx/1.1.2
> nginx: TLS SNI support enabled
> nginx: configure arguments: --prefix=/usr --sbin-path=/usr/sbin/nginx
> --conf-path=/etc/nginx/nginx.conf
> --error-log-path=/var/log/nginx/error_log --pid-path=/var/run/nginx.pid
> --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx
> --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib
> --http-log-path=/var/log/nginx/access_log
> --http-client-body-temp-path=/var/tmp/nginx/client
> --http-proxy-temp-path=/var/tmp/nginx/proxy
> --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi
> --http-scgi-temp-path=/var/tmp/nginx/scgi
> --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-file-aio
> --with-aio_module --with-pcre --without-http_auth_basic_module
> --without-http_geo_module --without-http_limit_req_module
> --without-http_limit_zone_module --without-http_memcached_module
> --without-http_referer_module --without-http_scgi_module
> --without-http_ssi_module --without-http_split_clients_module
> --without-http_userid_module --without-http_uwsgi_module
> --with-http_flv_module --with-http_geoip_module
> --with-http_stub_status_module --with-http_realip_module
>
> --add-module=/var/tmp/portage/www-servers/nginx-1.1.2/work/masterzen-nginx-upload-progress-module-8b55a34
> --with-http_ssl_module --without-mail_imap_module
> --without-mail_pop3_module --without-mail_smtp_module
>
> nginx.conf:
>
> user www www;
> worker_processes 2;
> worker_rlimit_nofile 10000;
> #worker_cpu_affinity 0001 0010 0100 1000;
>
> error_log /var/log/nginx/error_log warn;
>
> events {
>        worker_connections 128;
>        use epoll;
> #       debug_connection 217.24.65.183;
> }
>
> http {
>        include /etc/nginx/mime.types;
>        default_type application/octet-stream;
>
>        log_format main
>                '$remote_addr - $remote_user [$time_local] '
>                '"$request" $status $bytes_sent '
>                '"$http_referer" "$http_user_agent" '
>                '"$gzip_ratio" $request_time';
>
>        client_header_timeout 10m;
>        client_body_timeout 10m;
>        send_timeout 10m;
>
>        client_max_body_size 700m;
>        connection_pool_size 256;
>        client_body_buffer_size 1024k;
>        client_header_buffer_size 8k;
>        large_client_header_buffers 4 8k;
>        request_pool_size 4k;
>
>        proxy_buffering on;
>        proxy_buffer_size 4k;
>       proxy_buffers 4096 4k;
>
>        open_file_cache max=2000 inactive=60s;
>        open_file_cache_valid 60;
>        open_log_file_cache max=1000 inactive=60s valid=1m;
>
>        geoip_country /usr/share/GeoIP/GeoIP.dat; # the country IP
> database
>        geoip_city    /usr/share/GeoIP/GeoLiteCity.dat; # the city IP
> database
>
>        gzip on;
>        gzip_min_length 1100;
>        gzip_buffers 4 8k;
>        gzip_types text/plain text/css application/x-javascript text/xml
> application/xml application/xml+rss text/javascript;
>
>        output_buffers 1 32k;
>        postpone_output 1460;
>
>        aio on;
>        directio 512;
>        sendfile on;
>        tcp_nopush on;
>        tcp_nodelay on;
>
>        keepalive_timeout 75 20;
>        keepalive_disable msie6;
>
>        ignore_invalid_headers on;
>        server_name_in_redirect on;
>
>        fastcgi_pass_request_headers on;
>        fastcgi_intercept_errors on;
>        fastcgi_buffer_size 4k;
>        fastcgi_buffers 1024 4k;
>        fastcgi_read_timeout 300;
>       fastcgi_send_timeout 300;
>
>        index index.html;
>
>        upstream phpfarm {
>          server unix:/var/run/fastcgi/php-fpm-1.sock weight=100
> max_fails=3 fai
>          server unix:/var/run/fastcgi/php-fpm-2.sock weight=100
> max_fails=3 fai
>          server unix:/var/run/fastcgi/php-fpm-3.sock weight=100
> max_fails=3 fai
>        }
>
>        # upload progress
>        upload_progress uploads 1m;
>        upload_progress_content_type "application/json";
>        upload_progress_json_output;
>
> # virtual host configuration
>
>       # devel.testsite
>        server {
>                listen 80;
>                server_name devel.testsite;
>                client_max_body_size 1000m;
>
>                access_log /var/log/nginx/testsite.access_log main;
>                error_log /var/log/nginx/testsite.error_log warn;
>
>                root /opt/www/testsite;
>
>                location / {
>                  index index.php;
>                }
>
>                # include common settings
>                include common.conf;
>
>                charset utf-8;
>
>                location /data {
>                  deny all;
>                }
>
>                location = /uploads/progress {
>                  report_uploads uploads;
>                }
>
>                # glue css/js files into a single file for faster
> loading
>                rewrite .*/(css|javascript)/[^,]+,.+ /glue.php last;
>
>                location ~ ^(?<script_filename>.+\.php)$ {
>                  try_files $script_filename =404;
>                  include fastcgi_params;
>                  fastcgi_param SCRIPT_FILENAME
> $document_root$script_filename;
>                  fastcgi_pass phpfarm;
>                  track_uploads uploads 30s;
>                }
>        }
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?21,215157,215157#msg-215157
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-ru/attachments/20110913/4cfa17c7/attachment-0001.html>


Подробная информация о списке рассылки nginx-ru