Last active
February 21, 2016 07:32
-
-
Save AndroPlus-org/d1a1b1572e2052599474 to your computer and use it in GitHub Desktop.
手探りで作ってみたnginxをngx_brotli入りでビルドするスクリプト 無停止でアップグレードするにはどうすればいいのか…
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 | |
echo -n "Enter version number: " | |
read nginxv | |
# ngx_brotliの更新 | |
cd ~/nginx-build/ngx_brotli/ | |
git pull | |
if [ $? -eq 0 ]; then | |
cd ~/nginx-build/ | |
# nginx ダウンロードと展開 | |
wget -nc http://nginx.org/download/nginx-${nginxv}.tar.gz | |
sudo tar -xzf nginx-${nginxv}.tar.gz | |
if [ $? -eq 0 ]; then | |
cd nginx-${nginxv} | |
# ビルド | |
sudo ./configure --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --with-debug --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_dav_module --with-ipv6 --with-threads --add-module=../ngx_brotli | |
sudo make | |
# 設定が動くか確認 | |
~/nginx-build/nginx-${nginxv}/objs/nginx -t > /dev/null 2>&1 | |
if [ $? -eq 0 ]; then | |
echo "動作確認完了" | |
sudo service nginx stop | |
sudo make install | |
if [ $? -eq 0 ]; then | |
sudo service nginx start | |
rm -f ~/nginx-build/nginx-$nginxv.tar.gz | |
rm -rf ~/nginx-build/nginx-${nginxv} | |
echo "${nginxv}をインストールしました" | |
else | |
sudo service nginx start | |
echo "nginxのインストールに失敗しました" | |
fi | |
else | |
echo "動作確認失敗" | |
fi | |
else | |
echo "nginxダウンロード失敗" | |
fi | |
else | |
echo "ngx_brotliの更新失敗" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment