如果您对如何清除nginx的缓存?感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于如何清除nginx的缓存?的详细内容,我们还将为您解答如何清除nginx的缓存的相关问题,并
如果您对如何清除nginx的缓存?感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于如何清除nginx的缓存?的详细内容,我们还将为您解答如何清除nginx的缓存的相关问题,并且为您提供关于2种清除Safari的缓存的方法(Mac电脑如何清除缓存)、Nginx 中如何清除缓存?、nginx的缓存问题、php如何清除浏览器缓存?的有价值信息。
本文目录一览:如何清除nginx的缓存?(如何清除nginx的缓存)
我使用nginx作为前端服务器,我修改了CSS文件,但是nginx仍在使用旧文件。
我试图重新启动nginx,但没有成功,我已经用Google搜索,但是找不到清除它的有效方法。
一些文章说我们只能删除缓存目录:var/cache/nginx
,但是我的服务器上没有这样的目录。
我现在该怎么办?
答案1
小编典典我遇到了完全相同的问题-我在Virtualbox中运行了Nginx。我没有打开缓存。但是看起来像sendfile
已经设置好on
了nginx.conf
,这就是问题所在。@kolbyjack在上面的评论中提到了它。
当我关闭电源时sendfile
-工作正常。
Sendfile用于“在一个文件描述符和另一个文件描述符之间复制数据”,当在虚拟机环境中运行或至少通过Virtualbox运行时,显然存在一些实际麻烦。在nginx中关闭此配置会导致通过其他方法提供静态文件,您的更改将立即得到体现,而不会出现任何问题
2种清除Safari的缓存的方法(Mac电脑如何清除缓存)
2种清除Safari的缓存的方法(Mac电脑如何清除缓存)
如何清除Safari的缓存呢?每当您在Safari中浏览网络时,浏览器都会存储网站数据,因此您不必在每次重新访问网站时都再次下载该数据。从理论上讲,这应该可以加快您的浏览体验,但是在某些情况下,您可能需要清除缓存并重新开始。下面macz小编给大家整理了2种清除Safari的缓存的方法,快来跟小编看看吧!
在Mac上,有两种清除Safari缓存的方法。下文概述的第一种方法将删除与您访问的网站有关的所有内容,不仅包括网站的缓存版本,还包括Cookie和任何其他相关数据。所描述的第二种方法提供了更具针对性的方法,并且仅清除了Safari的缓存,但是它确实涉及启用隐藏菜单。
方法一:
1.在Mac上启动Safari浏览器。
2.选择Safari浏览器- >首选项
3.单击隐私选项卡,选择管理网站数据。
4.选择列出的网站,然后单击“删除”。要从Safari删除所有网站数据,请点击全部删除。
方法二:
1.在Mac上启动Safari浏览器。
2.选择Safari浏览器- >首选项
3.单击“高级”选项卡,然后在菜单栏中选中“显示开发”菜单旁边的框。
4.从菜单栏中,选择开发->空缓存。
以上就是小编给大家带来2种清除Safari的缓存的方法,希望对大家有所帮助。想了解更多关于Mac相关内容,请关注macz.com吧!
Nginx 中如何清除缓存?
Nginx1.0
Tomcat7.0.8
更新了Tomcat下的应用,改动了一个js文件
可是,访问始终都是没改之前的效果
跳过nginx直接访问,是js更新后的效果
我想应该是nginx的缓存问题
请问,怎么把nginx缓存的文件清除掉!呢?
在好个目录下?
目前nginx的配置,关系到缓存的配置如下:
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
代理转发配置
location /forestRight {
proxy_pass http://localhost:8088/forestRight;
}
请高人指点!
nginx的缓存问题
centos6.7 下 nginx之proxy_cache缓存测试:nginx1.9.15
nginx编译参数:
[root@iZ25dl26ykoZ nginx]# nginx -V
nginx version: nginx/1.9.15
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_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_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-ipv6 --add-module=../nginx_upstream_check_module-0.3.0 --add-module=../nginx-sticky-module-ng-1.2.5 --add-module=../ngx_cache_purge-2.3
nginx配置文件:
[root@iZ25dl26ykoZ nginx]# grep -v "#" /etc/nginx/nginx.conf| grep -v "^$"
worker_processes 1;pid /var/run/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main ''$remote_addr - $remote_user [$time_local] "$request" ''
''$status $body_bytes_sent "$http_referer" ''
''"$http_user_agent" "$http_x_forwarded_for"''
''"$upstream_cache_status"'';
access_log logs/access.log main;
sendfile on;
proxy_temp_path /var/cache/nginx/proxy_temp;
proxy_cache_path /var/cache/nginx/proxy_cache levels=1:2 keys_zone=cache_one:50m inactive=2d max_size=1g;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.1;
gzip_min_length 1k;
gzip_disable "MSIE [1-6].";
gzip_types text/plain application/x-javascript text/css text/javascript;
server {
listen 80;
server_name 101.200.149.28;
index index.html index.htm index.php;
location / {
root html;
index index.html index.htm;
}
location ~ .*\.(gif|jpg|png|html|css|js|ico|swf|pdf)(.*) {
root html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache cache_one;
proxy_cache_valid 200 304 301 302 8h;
proxy_cache_valid 404 1m;
proxy_cache_valid any 2d;
proxy_cache_key $host$uri$is_args$args;
expires 30d;
}
location ~ /purge(/.*) {
allow 127.0.0.1;
allow 119.40.36.230;
deny all;
proxy_cache_purge cache_one $host$1$is_args$args;
error_page 405 =200 /purge$1;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
include vhosts/*.conf;
}
缓存目录权限如下:
[root@iZ25dl26ykoZ nginx]# pwd
/var/cache/nginx
[root@iZ25dl26ykoZ nginx]# ls -lh
total 24K
drwxrwxrwx 2 nginx root 4.0K May 13 23:07 client_temp
drwxrwxrwx 2 nginx root 4.0K May 19 13:55 fastcgi_temp
drwxrwxrwx 2 nginx root 4.0K May 19 13:55 proxy_cache
drwxrwxrwx 2 nginx root 4.0K May 19 13:55 proxy_temp
drwxrwxrwx 2 nginx root 4.0K May 7 16:17 scgi_temp
drwxrwxrwx 2 nginx root 4.0K May 7 16:17 uwsgi_temp
cache 进程已启动。
[root@iZ25dl26ykoZ nginx]# ps -ef | grep nginx
root 19482 1 0 14:06 ? 00:00:00 nginx: master process nginx
nginx 19485 19482 0 14:06 ? 00:00:03 nginx: worker process
nginx 19486 19482 0 14:06 ? 00:00:00 nginx: cache manager process
测试:
请求 http://101.200.149.28/test.html响应头信息如下:
Cache-Control max-age=2592000
Connection keep-alive
Date Thu, 19 May 2016 07:15:30 GMT
Etag "573d4fef-33d7"
Expires Sat, 18 Jun 2016 07:15:30 GMT
Last-Modified Thu, 19 May 2016 05:32:31 GMT
Server nginx/1.9.15
根据此信息也可以看出浏览器缓存失效时间是25920000s,即30天。第一次访问时状态码为200,后面再访问的话就是304了。
http://101.200.149.28/purge/test.html
我多次访问test.html文件后,然后再访问http://101.200.149.28/purge/test.html,依然提示404,那就说明test.html没有没有被缓存。
也可以看到缓存目录下都是空的。
[root@iZ25dl26ykoZ nginx]# pwd
/var/cache/nginx
[root@iZ25dl26ykoZ nginx]# ls -R proxy_*
proxy_cache:
proxy_temp:
[root@iZ25dl26ykoZ nginx]#
php如何清除浏览器缓存?
php使用“header("last-modified:".gmdate( "d,d m y h:i:s") . "gmt");header("cache-control:no-cache,must-revalidate");”来清除缓存。
推荐:《PHP视频教程》
php清除浏览器缓存
今天在开发过程中遇到一个小问题,后台修改一本书的封面,上传图片后,由于浏览器的缓存导致修改之后,后台还是显示原先的封面,后来加入了两行代码搞定了这个问题。
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header("Cache-Control: no-cache, must-revalidate" );
说明:
立即学习“PHP免费学习笔记(深入)”;
header() 函数向客户端发送原始的 HTTP 报头。
认识到一点很重要,即必须在任何实际的输出被发送之前调用 header() 函数
语法
header(string,replace,http_response_code)
PHP header 的7种用法
1. 跳转页面
header('Location:'.$url); //Location和":"之间无空格。
2. 声明content-type
header('content-type:text/html;charset=utf-8');
3. 返回response状态码
header('HTTP/1.1 404 Not Found');
4. 在某个时间后执行跳转
header('Refresh: 10; url=http://www.baidu.com/'); //10s后跳转。
5. 控制浏览器缓存
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");
6. . 执行http验证
header('HTTP/1.1 401 Unauthorized'); header('WWW-Authenticate: Basic realm="Top Secret"');
7. 执行下载操作
header('Content-Type: application/octet-stream'); //设置内容类型 header('Content-Disposition: attachment; filename="example.zip"'); //设置MIME用户作为附件 header('Content-Transfer-Encoding: binary'); //设置传输方式 header('Content-Length: '.filesize('example.zip')); //设置内容长度
更多编程相关知识,可访问:编程入门!!
以上就是php如何清除浏览器缓存?的详细内容,更多请关注php中文网其它相关文章!
今天关于如何清除nginx的缓存?和如何清除nginx的缓存的分享就到这里,希望大家有所收获,若想了解更多关于2种清除Safari的缓存的方法(Mac电脑如何清除缓存)、Nginx 中如何清除缓存?、nginx的缓存问题、php如何清除浏览器缓存?等相关知识,可以在本站进行查询。
本文标签: