Nginx 用户名和密码下载软件的方法

更新:20120820 已确定初审录用,稿件名为 《给Nginx的目录浏览功能加把会变的锁》

写在前面——这个模型本身和NGINX的关系不是太大,Nginx就是一个载体,重要的是如何协同工作的问题,这个同时也是本站搭建用户名和密码下载系统的模型。

正文

我这里写的是一个思路,详细的我会投稿到网管员世界,如果能被选上,大家就会比较详细的知道设计模型了。

广告是一个大家都比较头疼的问题,本站建站初始也不想用广告拉住大家,可广告对网站管理者来说却是有很多好处的,最显著的好处就是能提高广大网站管理者的钱包,只有钱包鼓了,网站才能建的更好,更好的为大家服务。

在不影响大家浏览网页的前提下,我们从资源入手,对特定人群做资源服务。(例如下载和文档等)

实现起来并不难,需要一个广告入口页面,这里分布两个广告,GOOGLE和淘宝的。GOOGLE采用的搜索框形式,而大家也知道,近期GOOGLE总是莫名其妙的无法访问,这也是我引入淘宝的一个主要原因,在GOOGLE死了以后大家也可以通过淘宝广告点击获取用户名和密码。

获取的用户名和密码用在资源下载页,这里也不是什么高深的技巧,用到的是Nginx自身的
auth_basic
对这个不知道的朋友可以搜索一下,BAIDU即可,两行语句搞定

下面就是用户名和密码更新问题了
写了一个脚本,半小时执行一次,数据库和服务器上的文件同时更新,这样就OK了。

然后就是写点击广告的页面了,这个需要一些PHP知识和HTML知识,全OK后带用户名和密码的认证页面就搞定了,对我目前系统进行最小化改造可以达到这个效果。

nginx 1.2.3 稳定版8月7日放出,请注意更新

Changes with nginx 1.2.3                                         07 Aug 2012

    *) Feature: the Clang compiler support.

    *) Bugfix: extra listening sockets might be created.
       Thanks to Roman Odaisky.

    *) Bugfix: nginx/Windows might hog CPU if a worker process failed to
       start.
       Thanks to Ricardo Villalobos Guevara.

    *) Bugfix: the "proxy_pass_header", "fastcgi_pass_header",
       "scgi_pass_header", "uwsgi_pass_header", "proxy_hide_header",
       "fastcgi_hide_header", "scgi_hide_header", and "uwsgi_hide_header"
       directives might be inherited incorrectly.

    *) Bugfix: trailing dot in a source value was not ignored if the "map"
       directive was used with the "hostnames" parameter.

    *) Bugfix: incorrect location might be used to process a request if a
       URI was changed via a "rewrite" directive before an internal redirect
       to a named location.

Adobe Flash Media Server 4.5 x86/x64/Linux x64

最近测试,用到了这个,给大家个资源,请勿用于商业环境,谢谢!

Adobe® Flash® Media Server 4.5 software now delivers media to multiple platforms — including Apple iOS devices — with a choice of powerful protocols that can save significant bandwidth costs and lighten network load. Encode once and deliver across platforms with on-demand media packaging. Deliver exceptional media experiences with protected delivery and real-time encryption for your high-quality content. Adobe.Flash.Media.Server.v4.5.Incl.Keymaker-CORE Adobe.Flash.Media.Server.v4.5.x64.Incl.Keymaker-CORE Adobe.Flash.Media.Server.v4.5.Linux.x64.Incl.Keymaker-CORE No mirrors below please.

nginx更新1.1.14新版本,还为BUG修复版本

Changes with nginx 1.1.14                                        30 Jan 2012
) Feature: multiple "limit_req" limits may be used simultaneously.
) Bugfix: in error handling while connecting to a backend.        Thanks to Piotr Sikora.
) Bugfix: in AIO error handling on FreeBSD.
) Bugfix: in the OpenSSL library initialization.
) Bugfix: the "proxy_redirect" directives might not be correctly        inherited.
) Bugfix: memory leak during reconfiguration if the "pcre_jit"        directive was used.

关闭WordPress日志评论功能的一种方法(已测试)

近期,不知道咋回事,垃圾评论铺天盖地,根本没时间审核,找到了一种方法,可以关闭多少天以前的评论,现记录在此供大家学习使用

修改主题模板文件 functons.php ,加入一个新function

function close_comments( $posts ) {
if ( !is_single() ) { return $posts; }
if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( 30 * 24 * 60 * 60 ) ) {
$posts[0]->comment_status = 'closed';
$posts[0]->ping_status    = 'closed';
}
return $posts;

}

add_filter( 'the_posts', 'close_comments' );

以上30的单位是天,可以按需修改。

——-新版本的wordpress已经带超时评论关闭功能了,在设置里的讨论选项里,大家可以发掘一下

nginx 发布 1.1.13

Changes with nginx 1.1.13                                        16 Jan 2012

    *) Feature: the "TLSv1.1" and "TLSv1.2" parameters of the
       "ssl_protocols" directive.

    *) Bugfix: the "limit_req" directive parameters were not inherited
       correctly; the bug had appeared in 1.1.12.

    *) Bugfix: the "proxy_redirect" directive incorrectly processed
       "Refresh" header if regular expression were used.

    *) Bugfix: the "proxy_cache_use_stale" directive with "error" parameter
       did not return answer from cache if there were no live upstreams.

    *) Bugfix: the "worker_cpu_affinity" directive might not work.

    *) Bugfix: nginx could not be built on Solaris; the bug had appeared in
       1.1.12.

    *) Bugfix: in the ngx_http_mp4_module.
基本上还是一个BUG修复版本

shell 命令行下光标移动操作快捷键

放在这里免得忘了,C代表Ctrl,+ 就是一起按的意思

C+l  清屏命令
C+a 移动光标到行首
C+e 移动光标到行尾
C+h 往后删除一个字符
C+d 往前删除一个字符
C+b 往后移动一个字符
C+f 往前移动一个字符

C+w 剪切前一个单词(空格间隔的字符串单元)
C+u 剪切到行首
C+k 剪切到行尾
C+r 查找历史执行命令
C+p 前一条指令
C+n 后一条指令

nginx 1.1.12释出,圣诞节也不安生

Changes with nginx 1.1.12                                        26 Dec 2011

*) Change: a "proxy_pass" directive without URI part now uses changed
URI after redirection with the "error_page" directive;
Thanks to Lanshun Zhou.

*) Feature: the "proxy/fastcgi/scgi/uwsgi_cache_lock",
"proxy/fastcgi/scgi/uwsgi_cache_lock_timeout" directives.

*) Feature: the "pcre_jit" directive.

*) Feature: the "if" SSI command supports captures in regular
expressions.

*) Bugfix: the "if" SSI command did not work inside the "block" command.

*) Bugfix: the "limit_conn_log_level" and "limit_req_log_level"
directives might not work.

*) Bugfix: the "limit_rate" directive did not allow to use full
throughput, even if limit value was very high.

*) Bugfix: the "sendfile_max_chunk" directive did not work, if the
"limit_rate" directive was used.

*) Bugfix: a "proxy_pass" directive without URI part always used
original request URI if variables were used.

*) Bugfix: a "proxy_pass" directive without URI part might use original
request after redirection with the "try_files" directive;
Thanks to Lanshun Zhou.

*) Bugfix: in the ngx_http_scgi_module.

*) Bugfix: in the ngx_http_mp4_module.

*) Bugfix: nginx could not be built on Solaris; the bug had appeared in
1.1.9.

nginx 1.1.11 开发版释出

Changes with nginx 1.1.11                                        12 Dec 2011

*) Feature: the "so_keepalive" parameter of the "listen" directive.
Thanks to Vsevolod Stakhov.

*) Feature: the "if_not_empty" parameter of the
"fastcgi/scgi/uwsgi_param" directives.

*) Feature: the $https variable.

*) Feature: the "proxy_redirect" directive supports variables in the
first parameter.

*) Feature: the "proxy_redirect" directive supports regular expressions.

*) Bugfix: the $sent_http_cache_control variable might contain a wrong
value if the "expires" directive was used.
Thanks to Yichun Zhang.

*) Bugfix: the "read_ahead" directive might not work combined with
"try_files" and "open_file_cache".

*) Bugfix: a segmentation fault might occur in a worker process if small
time was used in the "inactive" parameter of the "proxy_cache_path"
directive.

*) Bugfix: responses from cache might hang.

关于正则表达式中的 “?”

这个问号有两层意思

一为匹配前面的子表达式零次或一次。例如,"do(es)?" 可以匹配 "do" 或 "does" 中的"do" 。? 等价于 {0,1}。

二为当该字符紧跟在任何一个其他限制符 (*, +, ?, {n}, {n,}, {n,m})
后面时,匹配模式是非贪婪的。非贪婪模式尽可能少的匹配所搜索的字符串,而默认的贪婪模式则尽可能多的匹配所搜索的字符串。例如,对于字符串 "oooo",’o+?’ 将匹配单个 "o",而 ‘o+’ 将匹配所有 ‘o’。

所以 (.*?)中问号的含义应匹配第二种解释,就是非贪婪模式,最小匹配原则