Linux 添加Nginx 到 service 启动 (完整篇)
来源:互联网 发布:php高性能框架 编辑:程序博客网 时间:2024/05/17 18:48
- groupadd www
- useradd -g www -M www
- tar zxvf pcre-7.8.tar.gz
- cd pcre-7.8/
- ./configure
- make && make install
- cd ../
- tar zxvf nginx-1.0.4.tar.gz
- cd nginx-1.0.4/
- ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
- make && make install
- cd ../
- #!/bin/bash
- # nginx Startup script for the Nginx HTTP Server
- #
- # 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=/usr/local/nginx/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: "
- $nginxd -s reload
- #if your nginx version is below 0.8, please use this command: "kill -HUP `cat ${nginx_pid}`"
- 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
0 0
- Linux 添加Nginx 到 service 启动 (完整篇)
- Linux 添加Nginx 到 service 启动
- Linux 添加Nginx 到 service 启动
- lnmp环境后续(nginx添加到service启动)
- lnmp环境后续(php-fpm添加到service启动)
- nginx开机自动启动(添加到服务)
- spring boot 应用添加到linux service
- 添加服务到开机自动启动(centos7开机自启动nginx,php-fpm)
- 将Nginx添加到系统服务(使其可使用service命令控制)
- 用service启动nginx
- linux 操作如何自动启动和添加service 启动
- 【Linux】Nginx完整配置
- Linux添加服务到开机自动启动
- Linux添加nginx为系统服务(service nginx status/start/stop/restart)
- nginx设定成service启动(centos 6.8)
- 如何把apache和nginx 加入到系统服务,用service 命令来控制启动、停止
- Linux 如何添加Service
- Linux添加service 服务
- android Installation failed due to invalid APK file 错误
- JSON--JavaScript对象表示法的基础知识介绍
- 导航栏 titleView 位置
- HTML 5 全局 contenteditable 属性
- ORACLE ORA-04030之 out of process memory when trying to allocate
- Linux 添加Nginx 到 service 启动 (完整篇)
- STM32 自定义延时函数
- C++大牛blog地址
- com.esotericsoftware.kryo.KryoException: Buffer overflow. Available: 0, required: 1
- ionic自定义图标
- 快速排序(Quick_Sort)
- ELK + Redis 日志分析系统 -学习第一天
- HTTPS 升级指南
- 微信分享域名防屏蔽 防拦截网址系统 免费实时查询域名是否被微信拦截实时检测微信屏蔽域名api