Last active
July 9, 2016 04:55
-
-
Save lapis-zero09/e99c448893832d5625ac to your computer and use it in GitHub Desktop.
さくらVPSに最新Nginx1.9系をインストールした話 ref: http://qiita.com/lapis_zero09/items/74b6ac261546dfee077e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH=/usr/local/nginx/sbin:$PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat /etc/redhat-release | |
CentOS release 6.7 (Final) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yum info nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo /usr/local/nginx/sbin/nginx -v | |
nginx version: nginx/1.9.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo vim ~/.bash_profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ source ~/.bash_profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo nginx -v | |
sudo: nginx: コマンドが見つかりません |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo visudo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo nginx -v | |
nginx version: nginx/1.9.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo vim /etc/init.d/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo chkconfig --add nginx | |
$ chkconfig --list nginx | |
nginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo yum -y install nginx | |
$ nginx -v | |
nginx version: nginx/1.8.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir ~/hoge | |
$ cd ~/hoge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ find ./ -type f -name "*.tar.gz" -exec tar zxf {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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