#!/bin/bash
echo "安装OPENRESTY "
sh /home/qa-deploy-utils/qa_shell_script/TEMP/install_openresty.sh 

echo "设置OPENRESTY 到系统PATH"
sed -i "7iexport PATH=/usr/local/openresty/nginx/sbin:\$PATH"  ~/.bash_profile 

echo "停止当前nginx"
nginx -s stop
service  nginx stop



echo "删除原来的nginx"
rm -rf /etc/nginx
rm -rf /home/quant_group/nginx/
rm -rf /usr/sbin/nginx

echo "环境变量重制"

source ~/.bash_profile
source ~/.bash_profile

echo "重新关联配置文件"
cd /usr/local/openresty/nginx/conf
rm -rf conf.d

ln -s /home/config_files/nginx_conf.d conf.d
rm -rf nginx.conf

echo  " nginx基础配置文件更新"
cp /home/qa-deploy-utils/qa_shell_script/TEMP/nginx.conf nginx.conf

echo "重启nginx"
nginx -p /usr/local/openresty/nginx -c /usr/local/openresty/nginx/conf/nginx.conf

ps -ef|grep nginx

