CentOS6 配置Nginx,MySql,php-fpm开机启动的方法
时间:2022-05-27 00:15:53|栏目:Linux|点击: 次
一. Nginx 开机启动
1、在/etc/init.d/目录下创建脚本
vim /etc/init.d/nginx
2、编写脚本内容 (将以下复制进去相应改动安装路径)
#!/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/webserver/nginx/sbin/nginx //这里改成之前的安装目录 nginx_config=/usr/local/webserver/nginx/conf/nginx.conf //这里改成之前的安装目录 nginx_pid=/usr/local/webserver/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/webserver/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
上一篇:CentOS 7.0编译安装lnmp教程(Nginx1.6.0+MySQL5.6.19+PHP5.5.14)
栏 目:Linux
下一篇:apachetop 实现实时监测web服务器运行情况
本文标题:CentOS6 配置Nginx,MySql,php-fpm开机启动的方法
本文地址:https://idc91.com/fuwuqizl/2609.html
您可能感兴趣的文章
- 06-17Linux进程信号的发送和保存方法
- 06-17Linux卸载自带jdk并安装新jdk版本的图文教程
- 06-17Linux系统中卸载与安装JDK的详细教程
- 06-17Linux系统配置NAT网络模式的详细步骤(附图文)
- 06-17Linux中的计划任务(crontab)使用方式
- 06-17Apache配置域名跳转的详细步骤
- 06-17Linux fsync系统调用方式
- 06-17Linux磁盘扩容lvm的使用详解
- 06-17Linux与Windows跨平台文件共享的实现方案
- 06-17Linux如何实现给/根目录扩容

