Ubuntu下安装淘宝开源Webserver tengine详细步骤教程

1、安装tengine之前需要安装PCRE库的安装

最新下载地址   ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

tar –zxvf pcre-8.21.tar.gz,解压目录为:pcre-8.21

然后进入到cd pcre-8.21,进行配置、编译、安装

安装zlib库安装

tar -zxvf zlib-1.2.5.tar.gz
cd zlib-1.2.5

./configure

make

makeinstall

安装openSSL库

下载页面:http://www.openssl.org/source/

tar –zxvf openssl-1.0.0.tar.gz,解压目录为:openssl-1.0.0

然后进入到cd openssl-1.0.0,进行配置、编译、安装

配置

./configure或./config

编译

make

安装

make install

2、安装 tengine

# cd /usr/local/src
# tar zxvf tengine-1.2.0.tar.gz
# cd tengine
# ./configure –prefix=/usr/local/nginx –conf-path=/usr/local/nginx/conf/nginx.conf –with-http_concat_module –with-http_realip_module –with-http_addition_module –with-http_gzip_static_module –with-http_random_index_module –with-http_stub_status_module –with-openssl=/usr/ –with-http_sub_module –with-http_dav_module –with-pcre=/usr/local/src/pcre-8.21
注意:–with-pcre=/usr/local/src/pcre-8.13指向的是源码包解压的路径,而不是安装的路径,否则会报错。
# make
# make install
# /usr/local/nginx/sbin/nginx   #启动
# chown nobody.nobody -R /usr/local/nginx/html
# chmod 700 -R /usr/local/nginx/html
设置tengine开启启动
vi /etc/rc.d/init.d/nginx  #编辑启动文件添加下面内容
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: – 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it’s not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog=”nginx”
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo “nginx already running….”
exit 1
fi
echo -n $”Starting $prog: “
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $”Stopping $prog: “
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $”Reloading $prog: “
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $”Usage: $prog {start|stop|restart|reload|status|help}”
exit 1
esac
exit $RETVAL
保存退出
# chmod 775 /etc/rc.d/init.d/nginx   #赋予文件执行权限
# chkconfig nginx on   #设置开机启动
# /etc/rc.d/init.d/nginx restart
# service nginx restart

语言教程python 函数参数的传递(参数带星号的说明)

python中函数参数的传递是通过赋值来传递的。函数参数的使用又有俩个方面值得注意:1.函数参数是如何定义的 2.在调用函数的过程中参数是如何被解析
先看第一个问题,在python中函数参数的定义主要有四种方式:
1.F(arg1,arg2,…)
这 是最常见的定义方式,一个函数可以定义任意个参数,每个参数间用逗号分割,用这种方式定义的函数在调用的的时候也必须在函数名后的小括号里提供个数相等的 值(实际参数),而且顺序必须相同,也就是说在这种调用方式中,形参和实参的个数必须一致,而且必须一一对应,也就是说第一个形参对应这第一个实参。例 如:
def a(x,y):
print x,y (全文…)

PHP实现计划任务

ignore_user_abort这个函数可以帮助我们实现像linux中的cron一样实现计划任务.

到底该如何用php的这个函数实现计划任务呢?还跌借助另外一个函数,这个函数是set_time_limit,通过set_time_limit(0)可 以设置程序的执行时间为无限制,php默认的执行时间是30秒,通过set_time_limit(0)可以让程序无限制的执行下去。在程序执行之前加上 ignore_user_abort(1)和set_time_limit(0)即可以了,最终程序该如何写呢?给大家一个例子。 (全文…)

php 验证码

首先验证码的原理就是,画一张图片,然后在这张图片上写一些字,然后加一些干扰的线条,像素点之类的东西就ok了,

这里要使用 php那就要知道php中画图的函数是那些,然后拿来用便是了。

如果要用php的画图函数,首先要启用这个模块的功能。就是把 php.ini中php_gd2.dll前面的注释去掉就好了。

下面开始画图: (全文…)

对 Python中的整数对象的理解

Object对象

(1)

PyObject是python中所有对象的基石。

typedef struct _object

{

int ob_refcnt ;  //引用计数

struct _typeobject *ob_type ; //指向对象的类型对象

}PyObject ;

我们用PyObject可以表示整数对象这类定长对象,但是像字符串这类非定长对象,就不能用PyOject结构体。于是我们引入了表示这类对象的 结构体—PyVarObject

typetdef struct

{

int ob_refcnt ;

struct _typeobject * ob_type ;

int ob_size ;

}PyVarObject ;

ob_size 表示变长对象中容纳的元素个数。

(全文…)

linux 下的时间函数使用

本文从介绍基础概念入手,探讨了在C/C++中对日期和时间操作所用到的数据结构和函数,并对计时、时间的获取、时间的计算和显示格式等方面进行了 阐述。本文还通过大量的实例向你展示了time.h头文件中声明的各种函数和数据结构的详细使用方法。

关键字:UTC(世界标准时 间),Calendar Time(日历时间),epoch(时间点),clock tick(时钟计时单元)

1.概念
在C/C ++中,对字符串的操作有很多值得注意的问题,同样,C/C++对时间的操作也有许多值得大家注意的地方。最近,在技术群中有很多网友也多次问到过C++ 语言中对时间的操作、获取和显示等等的问题。下面,在这篇文章中,笔者将主要介绍在C/C++中时间和日期的使用方法.

通过学习许 多C/C++库,你可以有很多操作、使用时间的方法。但在这之前你需要了解一些“时间”和“日期”的概念,主要有以下几个:

Coordinated Universal Time(UTC):协调世界时,又称为世界标准时间,也就是大家所熟知的格林威治标准时间(Greenwich Mean Time,GMT)。比如,中国内地的时间与UTC的时差为+8,也就是UTC+8。美国是UTC-5。

Calendar Time:日历时间,是用“从一个标准时间点到此时的时间经过的秒数”来表示的时间。这个标准时间点对不同的编译器来说会有所不同,但对一个编译系统来 说,这个标准时间点是不变的,该编译系统中的时间对应的日历时间都通过该标准时间点来衡量,所以可以说日历时间是“相对时间”,但是无论你在哪一个时区, 在同一时刻对同一个标准时间点来说,日历时间都是一样的。 (全文…)

linux top 命令详解

top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器。下面详细介绍它的使用方 法。
top – 01:06:48 up  1:22,  1 user,  load average: 0.06, 0.60, 0.48
Tasks:  29 total,   1 running,  28 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.3% us,  1.0% sy,  0.0% ni, 98.7% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:    191272k total,   173656k used,    17616k free,    22052k buffers
Swap:   192772k total,        0k used,   192772k free,   123988k cached
PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1379 root      16   0  7976 2456 1980 S  0.7  1.3   0:11.03 sshd
14704 root      16   0  2128  980  796 R  0.7  0.5   0:02.72 top
1 root      16   0  1992  632  544 S  0.0  0.3   0:00.90 init
2 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
统 计信息区
前五行是系统整体的统计信息。第一行是任务队列信息,同 uptime 命令的执行结果。其内容如下:
01:06:48
当 前时间
up 1:22
系统运行时间,格式为时:分
1 user
当前登录用户数
load average: 0.06, 0.60, 0.48
系统负载,即任务队列的平均长度。
(全文…)

php实现二维、多维数组排序

         $shop_child = array(
                    array(
                         'id'  => 1,
                         'name' => abc
                        ),
                     array(
                        'id' => 2,
                        'name' => def
                     )
            );

            $name = array();

            foreach($shop_child as $key=>$row) {
                $name[$key] = $row['name'];
            }

            $name = array_map('strtolower', $name);

            array_multisort($name, SORT_ASC, SORT_STRING, $shop_child);

(全文…)

Windows 图片和传真查看器 打不开图片 的解决办法

试试其他的看图软件能不能打开你用windows图片和传真查看器打不开的图片。如果不可以的话,可能是图片坏了。如果可以的话,有可能不支持这种格式或是你系统的注册表损坏。
此时可以使用下面的命令来修复:
运行 regsvr32 %windir%/system32/shimgvw.dll
(全文…)

不能打开文件:mk:@MSITStore:*.chm解决方法

不能打开文件:mk:@MSITStore:*.chm解决方法

开始->运行
regsvr32 hhctrl.ocx
regsvr32 itss.dll
就这么简单!

(全文…)