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
您可能感兴趣的文章
- 05-10Ubuntu系统安装ANSYS2021R1
- 05-10ANSYS2021R1安装方法Linux centos Ubuntu系统
- 11-07Linux中一对多配置日志服务器的详细步骤
- 11-07linux服务器安装SonarQube代码检测工具的详细步骤
- 11-07Apache自带的ab压力测试工具的实现
- 11-07apache虚拟主机配置的三种方式(小结)
- 11-07Linux在两个服务器直接传文件的操作方法
- 11-07xshell5使用ssh连接阿里云服务器的实现步骤
- 11-07linux查看服务器开放的端口和启用的端口多种方式
- 11-07Xshell连接centOS7并与CentOS7联网