Skip to content

Instantly share code, notes, and snippets.

@lapis-zero09
Last active July 9, 2016 04:55
Show Gist options
  • Save lapis-zero09/e99c448893832d5625ac to your computer and use it in GitHub Desktop.
Save lapis-zero09/e99c448893832d5625ac to your computer and use it in GitHub Desktop.
さくらVPSに最新Nginx1.9系をインストールした話 ref: http://qiita.com/lapis_zero09/items/74b6ac261546dfee077e
export PATH=/usr/local/nginx/sbin:$PATH
$ cat /etc/redhat-release
CentOS release 6.7 (Final)
$ yum info nginx
$ sudo /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.9.12
$ sudo /usr/local/nginx/sbin/nginx
$ tail /usr/local/nginx/logs/error.log
2016/03/02 17:18:03 [notice] 3008#0: signal process started
$ sudo vim ~/.bash_profile
$ source ~/.bash_profile
$ sudo nginx -v
sudo: nginx: コマンドが見つかりません
$ sudo visudo
$ sudo nginx -v
nginx version: nginx/1.9.12
$ sudo vim /etc/init.d/nginx
$ sudo rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
$ sudo chmod +x /etc/init.d/nginx
$ ls -l /etc/init.d/nginx
-rwxr-xr-x 1 root root 872 3月 3 18:55 2016 /etc/init.d/nginx
$ sudo chkconfig --add nginx
$ chkconfig --list nginx
nginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off
$ sudo yum -y install nginx
$ nginx -v
nginx version: nginx/1.8.1
$ mkdir ~/hoge
$ cd ~/hoge
$ wget http://nginx.org/download/nginx-1.9.12.tar.gz
$ wget https://www.openssl.org/source/openssl-1.0.2g.tar.gz
$ wget http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
$ wget http://zlib.net/zlib-1.2.8.tar.gz
$ tar zxvf nginx-1.9.12.tar.gz
$ tar zxvf openssl-1.0.2g.tar.gz
$ tar zxvf pcre-8.38.tar.gz
$ tar zxvf zlib-1.2.8.tar.gz
$ find ./ -type f -name "*.tar.gz" -exec tar zxf {} \;
$ ls
nginx-1.9.12 openssl-1.0.2g.tar.gz
nginx-1.9.12.tar.gz pcre-8.38 zlib-1.2.8.tar.gz zlib-1.2.8
openssl-1.0.2g pcre-8.38.tar.gz
$ cd nginx-1.9.12
$ ./configure --with-openssl=../openssl-1.0.2g/ --with-http_ssl_module --with-pcre=../pcre-8.38 --with-zlib=../zlib-1.2.8 --with-http_v2_module --with-debug
$ make
$ sudo make install
#!/bin/bash
#chkconfig: 2345 80 30
#description: nginx
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin/:/usr/sbin:/usr/bin
DESC="nginx deamon"
NAME=nginx
DAEMON=/usr/local/nginx/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
test -x $DAEMON || exit 0
d_start() {
$DAEMON || echo -n " already running"
}
d_stop() {
$DAEMON -s stop || echo -n " not running"
}
d_reload() {
$DAEMON -s reload || echo -n " could not reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
d_reload
echo "reloaded."
;;
restart)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 2
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
exit 3
;;
esac
exit 0
# Defaults env_keep += "HOME"
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Defaults env_keep += "HOME"
# Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment