pytanght
7/10/2018 - 3:01 PM

kingbox_install_script

Amateur project kingbox env install script

#!/bin/bash
#
#kingbox plug
#

set -e

#主域名配置
domain=`cat config.txt | grep -oP '(?<=domain=).*'`
if [[ $domain == "" ]];then
	echo "请先在config文件中配置主域名,如domain=www.baidu.com"
	exit 1
fi

#Py2环境
tar zxvf ./Python-2.7.11.tar.gz
cd Python-2.7.11/Python-2.7.11/
./configure --prefix=/usr/local/python2.7.11
make && make install
rm -rf /usr/bin/python
ln -s /usr/local/python2.7.11/bin/python2.7 /usr/bin/python
python ./get-pip.py
rm -rf /usr/bin/pip
ln -s /usr/local/python2.7.11/bin/pip /usr/bin/pip
pip install requests
pip install fire

#Nginx安装
tar zxvf nginx-1.13.1.tar.gz
cd nginx-1.13.1
./configure --prefix=/usr/local/nginx
sed "s#{{main_domain}}#$domain#" nginx.conf
mv -f nginx.conf /usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf


#添加插件
cp make_short_url /www/wwwroot/kingbox
chmod a+x /www/wwwroot/kingbox/make_short_url
cp domain_modify /www/wwwroot/kingbox
chmod a+x /www/wwwroot/kingbox/domain_modify