首先,在/etc/init.d/目录下创建nginx文件,实现nginx服务管理,提供start、 stop、 reload、 restart、 status5个参数 vim /etc/init.d/nginx 具体的脚本代码如下: #! /bin/bash #chkconfig:35 85 15 DAEMON=/usr/local/nginx/sbin/nginx PID=/usr/local/nginx/logs/nginx.pid case "$1" in start) echo...
# 解压安装包到指定目录 tar -zxvf php-5.5.24.tar.gz -C /usr/local/ # 进入解压包 cd /usr/local/php-5.5.24 # 配置 ./configure --prefix=/usr/local/php5 --with-gd --with-zlib --with-mysql=/usr/local/mysql --with-mysqli --with-config-file-path=/usr/local/php5 --enable-mbstri...
vim /etc/init.d/nginx#创建脚本文件内容如下:#!/bin/bash#chkconfig: - 99 20#description:Nginx Server Control ScriptCOM="/usr/local/nginx/sbin/nginx"PID="/usr/local/nginx/logs/nginx.pid"case"$1"instart)$COM;; stop)kill-s QUIT $(cat$PID) ;; restart)$0stop$0start ;; reload)kill-s...
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"] &&exit0 [ -x$nginxd] |...
# service nginx {start|stop|status|restart|reload|configtest} 1.4 yum安装 yum安装rpm包会比编译安装简单很多,默认会安装许多模块,但缺点是如果你想以后安装第三方模块那就没办法了。 # vi /etc/yum.repo.d/nginx.repo[nginx]name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearc...
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}" ...
[root@typecodes init.d]# chkconfig--add nginx[root@typecodes init.d]# chkconfig nginx on[root@typecodes init.d]# service nginx restart 还有一种在启动Nginx服务时,终端界面会卡住的情况:那就是Nginx的配置文件/etc/nginx/nginx.conf不正确,但是使用nginx -t命令显示正常。这种情况只能对nginx.conf文件...
chkconfig--add nginx chkconfig nginx on 3.4 编辑配置文件 代码语言:javascript 复制 cd/usr/local/nginx/conf/mv nginx.conf nginx.conf.bak//不使用系统自带的配置模板,把自带的备份下vim nginx.conf//拷贝如下配置文件:user nobody nobody;worker_processes2;error_log/usr/local/nginx/logs/nginx_error.lo...
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 ...
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}" ...