前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >安装nginx

安装nginx

作者头像
零月
发布2018-04-25 15:50:56
8620
发布2018-04-25 15:50:56
举报
文章被收录于专栏:从零开始的linux
代码语言:javascript
复制
# yum install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* -y
cd nginx-1.10.3
 ./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module
make && make install
# useradd  -s /sbin/nologin www
# vim /etc/init.d/nginx
#!/bin/bash
# chkconfig: - 30 21
# description: http service.
# Source Function Library
. /etc/init.d/functions
# Nginx Settings
NGINX_SBIN="/usr/local/nginx/sbin/nginx"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/nginx/logs/nginx.pid"
RETVAL=0
prog="Nginx"
start() {
  echo -n $"Starting $prog: "
  mkdir -p /dev/shm/nginx_temp
        daemon $NGINX_SBIN -c $NGINX_CONF
  RETVAL=$?
  echo
        return $RETVAL
}
stop() {
  echo -n $"Stopping $prog: "
        killproc -p $NGINX_PID $NGINX_SBIN -TERM
  rm -rf /dev/shm/nginx_temp
  RETVAL=$?
  echo
        return $RETVAL
}
reload(){
  echo -n $"Reloading $prog: "
        killproc -p $NGINX_PID $NGINX_SBIN -HUP
  RETVAL=$?
  echo
        return $RETVAL
}
restart(){
  stop
  start
}
configtest(){
  $NGINX_SBIN -c $NGINX_CONF -t
    return 0
}
case "$1" in
  start)
  start
        ;;
  stop)
  stop
        ;;
  reload)
        reload
        ;;
  restart)
  restart
        ;;
  configtest)
        configtest
        ;;
  *)
  echo $"Usage: $0 {start|stop|reload|restart|configtest}"
  RETVAL=1
esac
exit $RETVAL
# chmod 755 /etc/init.d/nginx 
# chkconfig --add nginx
# service nginx start
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2017-06-22,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 从零开始的linux 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档