nginx源码编译后启动脚本

简介:

nginx源码编译后启动脚本

 

 
  1. #!/bin/sh 
  2. # nginx - this script starts and stops the nginx daemin 
  3. # chkconfig:   - 85 15 
  4. # description:  Nginx is an HTTP(S) server, HTTP(S) reverse \ 
  5. #               proxy and IMAP/POP3 proxy server 
  6. # processname: nginx 
  7. # config:      /usr/local/nginx/conf/nginx.conf 
  8. # pidfile:     /usr/local/nginx/logs/nginx.pid 
  9.  
  10. # Source function library. 
  11. . /etc/rc.d/init.d/functions 
  12.  
  13. # Source networking configuration. 
  14. . /etc/sysconfig/network 
  15.  
  16. Check that networking is up. 
  17. "$NETWORKING" = "no" ] && exit 0 
  18.  
  19. nginx="/usr/local/nginx/sbin/nginx" 
  20. prog=$(basename $nginx) 
  21.  
  22. NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" 
  23.  
  24. lockfile=/var/lock/subsys/nginx 
  25.  
  26. start() { 
  27.     [ -x $nginx ] || exit 5 
  28.     [ -f $NGINX_CONF_FILE ] || exit 6 
  29.     echo -n $"Starting $prog: " 
  30.     daemon $nginx -c $NGINX_CONF_FILE 
  31.     retval=$? 
  32.     echo 
  33.     [ $retval -eq 0 ] && touch $lockfile 
  34.     return $retval 
  35.  
  36. stop() { 
  37.     echo -n $"Stopping $prog: " 
  38.     killproc $prog -QUIT 
  39.     retval=$? 
  40.     echo 
  41.     [ $retval -eq 0 ] && rm -f $lockfile 
  42.     return $retval 
  43.  
  44. restart() { 
  45.     configtest || return $? 
  46.     stop 
  47.     start 
  48.  
  49. reload() { 
  50.     configtest || return $? 
  51.     echo -n $"Reloading $prog: " 
  52.     killproc $nginx -HUP 
  53.     RETVAL=$? 
  54.     echo 
  55.  
  56. force_reload() { 
  57.     restart 
  58.  
  59. configtest() { 
  60.   $nginx -t -c $NGINX_CONF_FILE 
  61.  
  62. rh_status() { 
  63.     status $prog 
  64.  
  65. rh_status_q() { 
  66.     rh_status >/dev/null 2>&1 
  67.  
  68. case "$1" in 
  69.     start) 
  70.         rh_status_q && exit 0 
  71.         $1 
  72.         ;; 
  73.     stop) 
  74.         rh_status_q || exit 0 
  75.         $1 
  76.         ;; 
  77.     restart|configtest) 
  78.         $1 
  79.         ;; 
  80.     reload) 
  81.         rh_status_q || exit 7 
  82.         $1 
  83.         ;; 
  84.     force-reload) 
  85.         force_reload 
  86.         ;; 
  87.     status) 
  88.         rh_status 
  89.         ;; 
  90.     condrestart|try-restart) 
  91.         rh_status_q || exit 0 
  92.             ;; 
  93.     *) 
  94.         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" 
  95.         exit 2 
  96. esac 

 本文转自dongfang_09859 51CTO博客,原文链接:http://blog.51cto.com/hellosa/502924,如需转载请自行联系原作者

相关文章
|
应用服务中间件 Linux 网络安全
CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
243 0
|
应用服务中间件 nginx Docker
Docker镜像-基于DockerFile制作编译版nginx镜像
这篇文章介绍了如何基于Dockerfile制作一个编译版的nginx镜像,并提供了详细的步骤和命令。
1279 17
Docker镜像-基于DockerFile制作编译版nginx镜像
|
负载均衡 网络协议 应用服务中间件
web群集--rocky9.2源码部署nginx1.24的详细过程
Nginx 是一款由 Igor Sysoev 开发的开源高性能 HTTP 服务器和反向代理服务器,自 2004 年发布以来,以其高效、稳定和灵活的特点迅速成为许多网站和应用的首选。本文详细介绍了 Nginx 的核心概念、工作原理及常见使用场景,涵盖高并发处理、反向代理、负载均衡、低内存占用等特点,并提供了安装配置教程,适合开发者参考学习。
294 1
|
应用服务中间件 Linux nginx
在CentOS上使用源码包安装Nginx、以及手动启动Nginx的步骤过程
这篇文章介绍了在CentOS系统上使用Nginx源码包进行安装和配置的详细步骤,包括源码包的获取、解压、配置、编译、安装、启动验证以及注意事项。
1011 0
在CentOS上使用源码包安装Nginx、以及手动启动Nginx的步骤过程
|
安全 应用服务中间件 Linux
linux编译安装nginx
linux编译安装nginx
226 0
|
Ubuntu 应用服务中间件 Linux
Linux Centos7 ubuntu 安装nginx,脚本一键安装nginx
Linux Centos7 ubuntu 安装nginx,脚本一键安装nginx
367 2
|
Ubuntu 应用服务中间件 nginx
ubuntu编译安装nginx及安装nginx_upstream_check_module模块
以上是编译安装Nginx和安装 `nginx_upstream_check_module`模块的基本步骤。根据你的需求和环境,你可能需要进一步配置Nginx以满足特定的要求。
944 3
|
弹性计算 应用服务中间件 Shell
一键编译安装Nginx脚本
【4月更文挑战第30天】
344 1
|
弹性计算 应用服务中间件 Shell
编写nginx 启动脚本
【4月更文挑战第29天】
192 1
|
前端开发 应用服务中间件 网络安全
nginx配置SSL证书配置https访问网站 超详细(附加配置源码+图文配置教程)
nginx配置SSL证书配置https访问网站 超详细(附加配置源码+图文配置教程)
1652 2