加入收藏 | 设为首页 | 会员中心 | 我要投稿 应用网_丽江站长网 (http://www.0888zz.com/)- 科技、建站、数据工具、云上网络、机器学习!
当前位置: 首页 > 服务器 > 系统 > 正文

Centos6.2_(64位)服务器环境配置:源码编译Nginx

发布时间:2016-09-27 20:43:32 所属栏目:系统 来源:5ishare.com
导读:副标题#e# 上一回讲到配置环境的一些前期工作,以及编译安装Mysql5.3,如果不想错过任何细节,请阅读《(Centos6.2_64位)服务器环境配置:源码编译Mysql》一文。 今天趁下班前的一点空余时间,接着把Nginx部分也写写。 还 记得上一篇的一些约定吧:存放下

#vi /edt/init.d/nginx //创建名为nginx的脚本文件,输入以下内容,包括前边的#

#!/bin/sh
# www.5ishare.com
# nginx - this script starts and stops the nginx daemon
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /apps/nginx/conf/nginx.conf
# pidfile: /apps/nginx/logs/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="/apps/nginx/sbin/nginx"
NGINX_CONF_FILE="/apps/nginx/conf/nginx.conf"
prog=$(basename $nginx)
lockfile=/tmp/nginx.pid
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
}
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 && exit 0
$1 ;;

(编辑:应用网_丽江站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读