nginx错误页面跳转及设置文件缓存时间
时间:2014-07-09 20:18 来源:linux.it.net.cn 作者:IT网
Nginx错误页面跳转、nginx设置文件缓存时间。
1、设置Nginx错误页面跳转
1)、在http定义区域加入:
fastcgi_intercept_errors on;
2)、在server 区域加入:
复制代码代码如下:
error_page 500 404 403 /404.html;
或 error_page 500 502 503 504 404 403 http://www.it.net.cn;
2、Nginx 设置文件缓存时间
在server中添加以下配置,设置文件缓存时间为30天!
复制代码代码如下:
location ~.*\.(swf|jpg|gif|png|jpep|mp3|zip|map)$ {
expires 30d;
access_log /data/nginx_logs/linux.blog.it.net.cn.log;
}
(责任编辑:IT)
Nginx错误页面跳转、nginx设置文件缓存时间。
1、设置Nginx错误页面跳转
复制代码代码如下:
error_page 500 404 403 /404.html;
或 error_page 500 502 503 504 404 403 http://www.it.net.cn;
2、Nginx 设置文件缓存时间
复制代码代码如下:
location ~.*\.(swf|jpg|gif|png|jpep|mp3|zip|map)$ {
(责任编辑:IT)expires 30d; access_log /data/nginx_logs/linux.blog.it.net.cn.log; } |