3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nginxをdebian6でキレイにエラー無しでコンパイルする方法まとめ

Last updated at Posted at 2014-05-21

nginxをdebian6環境下でSPDY付きでキレイにコンパイルするまとめです。コピー・ペーストだけでもコンパイルできるかと思いますが、ある程度理解してからその手段に出て欲しいのと、最新版をしっかりと利用してください。下記バージョンは現時点での最新版となっています。

問題のあったopenssl heartbeatですがopenssl-1.0.1c.tar.gzでは問題はありません。

# apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
# cd /usr/local/src
# wget http://nginx.org/download/nginx-1.7.0.tar.gz
# wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
# tar zxvf nginx-1.5.5.tar.gz
# tar zxvf openssl-1.0.1g.tar.gz
# cd nginx-1.5.5
# ./configure --with-openssl=/usr/local/src/openssl-1.0.1g  --with-http_ssl_module --with-http_spdy_module
# make
# make install

/usr/local/nginx にnginxのすべてがインストールされます。インストール場所を変えたい場合は–prefixなどをconfigureで変えてあげてください。

起動用スクリプトは下記の通り
※ nginx.conf などで pidファイルを /var/run/nginx.pid と設定してください。pidファイルを指定しないとnginx stopは動作しません。

/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-Description: starts the nginx web server
# Description:       starts nginx using start-stop-daemon
### END INIT INFO

PATH=/usr/local/nginx/sbin:/usr/local/nginx/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/nginx/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 /var/run/$NAME.pid \
                --exec $DAEMON -- $DAEMON_OPTS || true
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
                --exec $DAEMON || true
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON || true
        sleep 1
        start-stop-daemon --start --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
        echo "$NAME."
        ;;
  reload)
      echo -n "Reloading $DESC configuration: "
      start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
          --exec $DAEMON || true
      echo "$NAME."
      ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        exit 1
        ;;
esac
exit 0
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?