zyk198500 发表于 2018-11-12 09:24:44

Nginx 0.7.67 安装

Nginx 安装:
  wget http://nginx.org/download/nginx-0.7.67.tar.gz
  tar -zxvf nginx-0.7.67.tar.gz
  cd nginx-0.7.67
  ./configure –sbin-path=/usr/local/sbin –with-http_ssl_module –with-http_stub_status_module
  make && make install
  vi /etc/init.d/nginx
  #! /bin/sh
  ### BEGIN INIT INFO
  # Provides: nginx
  # Required-Start: $all
  # Required-Stop: $all
  # Default-Start: 2 3 4 5
  # Default-Stop: 0 1 6
  # Short-De.ion: starts the nginx web server
  # De.ion: starts nginx using start-stop-daemon
  ### END INIT INFO
  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  DAEMON=/usr/local/sbin/nginx
  NAME=nginx
  DESC=nginx
  test -x $DAEMON || exit 0
  # Include nginx defaults if available
  if [ -f /etc/default/nginx ] ; then
  . /etc/default/nginx
  fi
  set -e
  case “$1″ in
  start)
  echo -n “Starting $DESC: “
  start-stop-daemon –start –quiet –pidfile /usr/local/nginx/logs/nginx.pid \
  –exec $DAEMON — $DAEMON_OPTS
  echo “$NAME.”
  ;;
  stop)
  echo -n “Stopping $DESC: “
  start-stop-daemon –stop –quiet –pidfile /usr/local/nginx/logs/nginx.pid \
  –exec $DAEMON
  echo “$NAME.”
  ;;
  restart|force-reload)
  echo -n “Restarting $DESC: “
  start-stop-daemon –stop –quiet –pidfile \
  /usr/local/nginx/logs/nginx.pid –exec $DAEMON
  sleep 1
  start-stop-daemon –start –quiet –pidfile \
  /usr/local/nginx/logs/nginx.pid –exec $DAEMON — $DAEMON_OPTS
  echo “$NAME.”
  ;;
  reload)
  echo -n “Reloading $DESC configuration: “
  start-stop-daemon –stop –signal HUP –quiet –pidfile /usr/local/nginx/logs/nginx.pid \
  –exec $DAEMON
  echo “$NAME.”
  ;;
  *)
  N=/etc/init.d/$NAME
  echo “Usage: $N {start|stop|restart|force-reload}” >&2
  exit 1
  ;;
  esac
  exit 0
  添加脚本到系统默认运行级别
  /usr/sbin/update-rc.d -f nginx defaults
  由于nginx是安装在/usr/local/,可以链接到我们常用的/etc/下
  ln -s /usr/local/nginx /etc/nginx
  chmod 755 /etc/init.d/nginx
  安装完成
  /etc/inti.d/nginx start 启动nginx

页: [1]
查看完整版本: Nginx 0.7.67 安装