一、ftp连接方式1、命令连接ftp在与用户交互时,首先打开的是TCP的21号端口,建立命令连接,这个连接会始终存在,直到用户输入bye的那一刻,才断开命令连接。2、数据连接1)主动连接主动连接是基于TCP21号端口的,这种方式下,是ftp服务器主动去连接客户端的,而客户端该使用哪..
分类:
其他 时间:
2014-04-06 06:56:54
收藏:
0 评论:
0 赞:
0 阅读:
605
#!/bin/shauto_ssh(){expect-c"settimeout-1;spawnssh-oStrictHostKeyChecking=no-p8000-t$1${*:2};expect{(yes/no)?{send--yes\r;exp_continue}*assword*{send--\r;expect{*denied*{exit2;}eof}}eof{exit1;}}"return$?}auto_ssh192.168.0.166ifconfigauto_scp(){expect-c"sett..
分类:
其他 时间:
2014-04-06 06:41:47
收藏:
0 评论:
0 赞:
0 阅读:
510
#!/bin/sh#lastupdate2013/08/21###start./etc/rc.d/init.d/functions./etc/sysconfig/networkif[$#-eq0];thenecho-n"Pleasespecifyhosts:"readhostsif[-z$hosts];thenecho-e"\033[40;31mexit.....\033[0m"exit2elseexporthostsfielsehosts=$1exporthostsfiecho-n"Testingto$ho..
分类:
其他 时间:
2014-04-06 06:43:32
收藏:
0 评论:
0 赞:
0 阅读:
492
#include<stdio.h>inthanoi(intn,chara,charb,charc){if(n>0){if(n==1){printf("%c->%c\n",a,c);}else{hanoi(n-1,a,c,b);printf("%c->%c\n",a,c);hanoi(n-1,b,a,c);}}}intmain(){hanoi(8,‘a‘,‘b‘,‘c‘);getchar();return0;}
分类:
其他 时间:
2014-04-06 05:14:50
收藏:
0 评论:
0 赞:
0 阅读:
437
#include<stdio.h>voidpermutation(chars[],intb,inte){if((0<=b)&&(b<=e)){if(b==e){printf("%s\n",s);}else{inti=0;for(i=b;i<=e;i++){charc=s[b];s[b]=s[i];s[i]=c;permutation(s,b+1,e);c=s[b];s[b]=s[i];s[i]=c;}}}}intmain(){chars[]="abcd";perm..
分类:
其他 时间:
2014-04-06 05:16:34
收藏:
0 评论:
0 赞:
0 阅读:
390
#include<stdio.h>#defineN8typedefstruct_tag_Pos{intios;intjos;}Pos;staticcharboard[N+2][N+2];staticPospos[]={{-1,-1},{-1,0},{-1,1}};staticintcount=0;voidinit(){inti=0;intj=0;for(i=0;i<N+2;i++){board[0][i]=‘#‘;board[N+1][i]=‘#‘;board[i][0]=‘#‘;board..
分类:
其他 时间:
2014-04-06 06:33:17
收藏:
0 评论:
0 赞:
0 阅读:
441
假如我的站点后台地址为:http://www.abc.net/admin.php那么我想限制只有个别ip可以访问后台,那么需要在配置文件中增加:12location~.*admin.*{3allow1.1.1.1;4allow12.12.12.0/24;5denyall;6location~\.php${7includefastcgi_params;8fastcgi_passunix:/tmp/php-fcgi.sock;9f..
分类:
其他 时间:
2014-04-06 05:48:23
收藏:
0 评论:
0 赞:
0 阅读:
979
flag标记有:last相当于Apache里的[L]标记,表示完成rewritebreak终止匹配,不再匹配后面的规则redirect返回302临时重定向地址栏会显示跳转后的地址permanent返回301永久重定向地址栏会显示跳转后的地址
分类:
其他 时间:
2014-04-06 06:55:17
收藏:
0 评论:
0 赞:
0 阅读:
558
文件及目录匹配,其中:*-f和!-f用来判断是否存在文件*-d和!-d用来判断是否存在目录*-e和!-e用来判断是否存在文件或目录*-x和!-x用来判断文件是否可执行样例:判断访问的图片是否存在,不存在跳转到另外的域名location~*^.+.(jpg|jpeg|gif|css|png|js|ico|thumb){root/data/www..
分类:
其他 时间:
2014-04-06 06:11:52
收藏:
0 评论:
0 赞:
0 阅读:
6014
EvenFibonaccinumbersProblem2EachnewtermintheFibonaccisequenceisgeneratedbyaddingtheprevioustwoterms.Bystartingwith1and2,thefirst10termswillbe:1,2,3,5,8,13,21,34,55,89,...ByconsideringthetermsintheFibonaccisequencewhosevaluesdonotexceedfourmillion,findthesum..
分类:
其他 时间:
2014-04-06 05:18:15
收藏:
0 评论:
0 赞:
0 阅读:
493
我的需求是,想根据时间戳规则来配置rewrite跳转。默认的nginx版本是实现不了这个需求的,因为它不带有时间戳参数,所以需要下载tengine来配置,安装和配置方法和nginx一模一样,下载地址为:http://tengine.taobao.org/核心点在于这里的$unix_time参考http://tengine.taobao.o..
分类:
其他 时间:
2014-04-06 04:56:21
收藏:
0 评论:
0 赞:
0 阅读:
2068
有时候有这样的需求,凡是从百度或者google点过来的请求,也就是说,当用后搜索到你的站点时,一旦他从搜索引擎的搜索页面进到我们的网站时,就可以做一个跳转。其实,说实话,这样做也没有什么太大意义,但是nginx的确可以实现这样的操作:在配置文件的server{}中加入如下配置..
分类:
其他 时间:
2014-04-06 06:08:27
收藏:
0 评论:
0 赞:
0 阅读:
2499
nginx的日志格式中,有一个字段叫做$http_user_agent这个其实是客户端浏览器的一个信息,比如咱们平时使用IE浏览器的话,nginx的日志中会记录类似于这样的信息:Mozilla/4.0(compatible;MSIE7.0;WindowsNT5.1)这一段信息就是$http_user_agent了。咱们可以根据这个特点来控制客..
分类:
其他 时间:
2014-04-06 08:04:02
收藏:
0 评论:
0 赞:
0 阅读:
653
线上一台机器(该论坛所在机器)近期频繁出现502,每100次访问就会出现10次,这频率也太高了。于是开始了我的502排查之旅。1.1psaux|grep-cphp复制代码结果为2002netstat-an|grep-cphp复制代码结果一直在5以下,这说明php-cgi的进程是绝对够用的。2.查看php-fpm.log3tail-f/usr..
分类:
其他 时间:
2014-04-06 08:05:42
收藏:
0 评论:
0 赞:
0 阅读:
531
在配置nginx.conf的时候,有一项是指定错误日志的,默认情况下你不指定也没有关系,因为nginx很少有错误日志记录的。但有时出现问题时,是有必要记录一下错误日志的,方便我们排查问题。error_log级别分为debug,info,notice,warn,error,crit默认为crit,该级别在日志名后边定义..
分类:
其他 时间:
2014-04-06 05:28:28
收藏:
0 评论:
0 赞:
0 阅读:
343
#include<stdio.h>
#include<malloc.h>
#include<string.h>
//串的堆分配存储结构
typedefstruct{
char*ch;
intlength;
}heap;
//串赋值
intstr_assign(heap*str,char*chars)
{
intcount;
char*c;
inti;
//若串str已经存在,则释放所占空间
printf("%s\n",ch..
分类:
其他 时间:
2014-04-06 05:30:06
收藏:
0 评论:
0 赞:
0 阅读:
485
nginx的日志格式中,有一个字段叫做$http_user_agent这个其实是客户端浏览器的一个信息,比如咱们平时使用IE浏览器的话,nginx的日志中会记录类似于这样的信息:Mozilla/4.0(compatible;MSIE7.0;WindowsNT5.1)这一段信息就是$http_user_agent了。咱们可以根据这个特点来控制客..
分类:
其他 时间:
2014-04-06 07:55:36
收藏:
0 评论:
0 赞:
0 阅读:
580
LargestprimefactorProblem3Theprimefactorsof13195are5,7,13and29.Whatisthelargestprimefactorofthenumber600851475143?最大的素数因数问题313195的素数因数是5,7,13和29.那么数字600851475143最大的素数因数的多少?publicclassEuler3
{
//返回一个一维素数数组,长度为lengt..
分类:
其他 时间:
2014-04-06 05:55:11
收藏:
0 评论:
0 赞:
0 阅读:
540
错误信息"proxy_pass"maynothaveURIpartinlocationgivenbyregularexpression,我的配置文件location~.*\.(php|jsp|cgi)?${proxy_passhttp://192.168.2.1:8080/;proxy_set_headerHost$host;proxy_set_headerX-Forwarded-For$remote_addr;proxy_set_headerX-Forwarded-For$proxy_a..
分类:
其他 时间:
2014-04-06 06:15:12
收藏:
0 评论:
0 赞:
0 阅读:
505
首先建立下面的配置文件放在nginx的conf目录下面,命名为deny.ipcatdeny.ipdeny192.168.1.11;deny192.168.1.123;deny10.0.1.0/24;在nginx的配置文件nginx.conf中加入:includedeny.ip;重启一下nginx的服务:/usr/local/nginx/sbin/nginxreload就可以生效了。deny.ip的格式中也可..
分类:
其他 时间:
2014-04-06 06:40:04
收藏:
0 评论:
0 赞:
0 阅读:
450