nginx 开机自动启动教程
来源:互联网 发布:淘宝的司法拍卖靠谱 编辑:程序博客网 时间:2024/06/06 11:11
vi /etc/init.d/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
#!/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=
/var/run/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
/var/run/nginx
.pid
}
# reload nginx service functions.
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
:wq 保存并退出
设置文件的访问权限
chmod a+x /etc/init.d/nginx (a+x ==> all user can execute 所有用户可执行)
最后 ln -s ../init.d/nginx /etc/rc.d/rc2.d/S99nginx
原文:
1. http://archive.cnblogs.com/a/1945882 (代码原文)
2. http://www.linuxeden.com/html/sysadmin/20111022/115277.html (软链原文)
- nginx 开机自动启动教程
- nginx开机自动启动脚本
- nginx开机自动启动脚本
- nginx开机自动启动脚本
- 开机自动启动tomcat+memcached+nginx
- windows下设置Nginx开机自动启动
- NGINX、PHP-FPM开机自动启动
- 设置nginx开机自动启动方法
- nginx开机自动启动(添加到服务)
- CentOS下设置nginx开机自动启动和chkconfig管理
- centos7 配置nginx服务、设置开机自动启动
- nginx设置成服务并开机自动启动
- nginx设置成服务并开机自动启动
- 添加服务到开机自动启动(centos7开机自启动nginx,php-fpm)
- Nginx开机启动脚本
- 开机自启动nginx
- Nginx开机启动
- linux nginx开机启动
- skyeye1.3.5在ubuntu12.04上的安装
- SEH in ASM 研究
- 一行字符串,寻找其中出现相同且长度最长的子串
- 应用程序基础之03Manifest文件(一)
- 用 Hadoop 进行分布式数据处理,第 1 部分: 入门
- nginx 开机自动启动教程
- Android学习篇章33-Service基础
- OCP-1Z0-053-V12.02-159题
- linux下使用GCC生存和使用静态、动态库
- exit:c++非线程安全
- udx linux/win/android开发包发布
- [HGE]-源码分析-10 resource
- mmap 和 munap函数
- vsftpd自启动(开机启动)的三种方法