Tengine安装教程,
Tengine安装教程,
1. 把安装包拷贝到/opt
安装依赖 yum -y install gcc openssl-devel pcre-develzlib-devel
2,进入安装完毕的软件目录,必须要进入Tengine的装目录。该目录下面有一个configure文件。用于验证依赖。复制下面的代码,直接粘贴过去。用于检查第一步安装的依赖是否全部安装完毕
./configure
make 编译
make install 安装
4,加入到开机启动目录 chkconfig --add ngnix
5,把ngnix加入到系统服务里面
把nginx添加到系统服务中
使其可以使用service nginx start/stop/restart等
第一步 写脚本,名为nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
#!/bin/sh
#
#
nginx - this script starts and stops the nginx daemon
#
#
chkconfig: - 85 15
#
description: Nginx is an HTTP(S) server, HTTP(S) reverse \
#
proxyand IMAP/POP3 proxy server
#
processname: nginx
#
config: /etc/nginx/nginx.conf
#
config: /etc/sysconfig/nginx
#
pidfile: /var/run/nginx.pid
#
Source function library.
. /etc/rc .d /init .d /functions
#
Source networking configuration.
. /etc/sysconfig/network
#
Check that networking is up.
[ "$NETWORKING" = "no" ]
&& exit 0
nginx= "/usr/local/nginx/sbin/nginx"
prog=$( basename $nginx)
NGINX_CONF_FILE= "/usr/local/nginx/conf/nginx.conf"
[
-f /etc/sysconfig/nginx ]
&& . /etc/sysconfig/nginx
lockfile= /var/lock/subsys/nginx
start()
{
[
-x $nginx ] || exit 5
[
-f $NGINX_CONF_FILE ] || exit 6
echo -n
$ "Starting
$prog: "
daemon
$nginx -c $NGINX_CONF_FILE
retval=$?
echo
[
$retval - eq 0
] && touch $lockfile
return $retval
}
stop()
{
echo -n
$ "Stopping
$prog: "
killproc
$prog -QUIT
retval=$?
echo
[
$retval - eq 0
] && rm -f
$lockfile
return $retval
killall
-9 nginx
}
restart()
{
configtest
|| return $?
stop
sleep 1
start
}
reload()
{
configtest
|| return $?
echo -n
$ "Reloading
$prog: "
killproc
$nginx -HUP
RETVAL=$?
echo
}
force_reload()
{
restart
}
configtest()
{
$nginx
-t -c $NGINX_CONF_FILE
}
rh_status()
{
status
$prog
}
rh_status_q()
{
rh_status
> /dev/null 2>&1
}
case "$1" in
start)
rh_status_q
&& exit0
$1
;;
stop)
rh_status_q
|| exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q
|| exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q
|| exit 0
;;
*)
echo $ "Usage:
$0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
|
2、添加
[root@rh6 ~]# cp nginx /etc/init.d/
[root@rh6 ~]# chmod 755 /etc/init.d/nginx
[root@rh6 ~]# chkconfig --add nginx
3、测试
[root@rh6 ~]# service nginx start
[root@rh6 ~]# service nginx stop
[root@rh6 ~]# service nginx reload
也可以按照同样方法添加其他的服务。
评论暂时关闭