首页 > 其他 > 详细

nginx配置文件中使用时间戳参数

时间:2014-04-06 04:56:21      阅读:2068      评论:0      收藏:0      [点我收藏+]

我的需求是,想根据时间戳规则来配置rewrite跳转。
默认的nginx版本是实现不了这个需求的,因为它不带有时间戳参数, 所以需要下载tengine来配置,安装和配置方法和nginx一模一样,下载地址为: http://tengine.taobao.org/

核心点在于这里的 $unix_time   参考 http://tengine.taobao.org/document_cn/variables_cn.html
我们还可以使用 $year 表示四位的年份, $year2 表示两位的年份,$month , $day, $hour, $hour12, $minute, $second


   if ($document_uri !~ ‘st‘) {
          rewrite ^/(.*)$  /st/$unix_time/$1 redirect;
   }

或者:

   if ($document_uri !~ ‘st‘) {
          rewrite ^/(.*)$  /st/$year$month$day$hour$minute/$1 redirect;
   }


本文出自 “Linux运维” 博客,请务必保留此出处http://2853725.blog.51cto.com/2843725/1390974

nginx配置文件中使用时间戳参数,布布扣,bubuko.com

nginx配置文件中使用时间戳参数

原文:http://2853725.blog.51cto.com/2843725/1390974

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!