阿里云服务器web环境Apache+Nginx重新换回Tengine

Apache+Nginx这种方式有好有坏,应用在一些流量大的站点是可以有的,而且效率惊人,具体怎么样不扯那么多,不好之处就是是

会消耗服务器过多资源, 这样下来,服务器配置就高了!所以一般中小站点,没什么必要这种搭配使用。比如公司网站这类流量少

的,用一种即可。客家网络之前是Apache+Nginx的方式撑了8个月,整整八个月!一点问题没有。下面介绍下阿里云服务器web环境

Apache+Nginx重新换回Tengine. 


大致的步骤:


第一步:比较敏感的操作,重装系统。一般是用centos 6.5 32位/64位  

阿里云服务器web环境Apache+Nginx重新换回Tengine_第1张图片


第二步:挂载数据盘,然后恢复数据,确保数据完好,一般提前备份快照!


第三步:安装军哥lnmp,现在是1.1,非常赞的集成,关键自主管理及其方便,不、譬如升级PHP、Apache等扩展都很灵活,推荐

使用。

安装什么http://lnmp.org/都有详细的描述。安装完成了LNMP先不要配置虚拟主机,直接平滑升级Tengine


之前有人做过了脚本,昨晚也测试确实可用!链接如下:http://www.zntec.cn/archives/upgrade_tengine.html


升级脚本如下:


#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

# Check if user is root
if [ $(id -u) != "0" ]; then
    echo "Error: You must be root to run this script, please use root to install lnmp"
    exit 1
fi

clear
echo "========================================================================="
echo "Upgrade Tengine for LNMP,  Modify by Tomas"
echo "========================================================================="
echo "LNMP is tool to auto-compile & install Tengine+MySQL+PHP on Linux "
echo ""
echo "For more information please visit http://www.zntec.cn/"
echo "========================================================================="

nv=`/usr/local/nginx/sbin/nginx -v 2>&1`
old_nginx_version=`echo $nv | cut -c22-`
#echo $old_nginx_version

if [ "$1" != "--help" ]; then

#set nginx version

	nginx_version=""
	echo "Current tengine Version:$old_nginx_version"
	echo "Please input tengine version you want:"
	echo "You can get version number from http://tengine.taobao.org/download_cn.html"
	read -p "(example: 2.0.2 ):" nginx_version
	if [ "$nginx_version" = "" ]; then
		echo "Error: You must input tengine version!!"
		exit 1
	fi
	echo "==========================="

	echo "You want to upgrade tengine version to $nginx_version"

	echo "==========================="

	get_char()
	{
	SAVEDSTTY=`stty -g`
	stty -echo
	stty cbreak
	dd if=/dev/tty bs=1 count=1 2> /dev/null
	stty -raw
	stty echo
	stty $SAVEDSTTY
	}
	echo ""
	echo "Press any key to start...or Press Ctrl+c to cancel"
	char=`get_char`

echo "============================check files=================================="
if [ -s tengine-$nginx_version.tar.gz ]; then
  echo "tengine-$nginx_version.tar.gz [found]"
  else
  echo "Error: tengine-$nginx_version.tar.gz not found!!!download now......"
  wget -c http://tengine.taobao.org/download/tengine-$nginx_version.tar.gz
  if [ $? -eq 0 ]; then
	echo "Download tengine-$nginx_version.tar.gz successfully!"
  else
	echo "WARNING!May be the tengine version you input was wrong,please check!"
	echo "tengine Version input was:"$nginx_version
	sleep 5
	exit 1
  fi
fi
echo "============================check files=================================="
echo "Stoping MySQL..."
/etc/init.d/mysql stop
echo "Stoping PHP-FPM..."
/etc/init.d/php-fpm stop
if [ -s /etc/init.d/memceached ]; then
  echo "Stoping Memcached..."
  /etc/init.d/memcacehd stop
fi

rm -rf tengine-$nginx_version/

tar zxvf tengine-$nginx_version.tar.gz
cd tengine-$nginx_version/
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
make

mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
cp objs/nginx /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -t
make upgrade
echo "Upgrade completed!"
echo "Program will display Nginx Version......"
/usr/local/nginx/sbin/nginx -v
cd ../

echo "Restarting Nginx..."
/etc/init.d/nginx restart

echo "Starting MySQL..."
/etc/init.d/mysql start
echo "Starting PHP-FPM..."
/etc/init.d/php-fpm start
if [ -s /etc/init.d/memceached ]; then
  echo "Starting Memcached..."
  /etc/init.d/memcacehd start
fi

echo "========================================================================="
echo "You have successfully upgrade from $old_nginx_version to $nginx_version"
echo "========================================================================="
echo "LNMP is tool to auto-compile & install Tengine+MySQL+PHP on Linux "
echo "========================================================================="
echo ""
echo "For more information please visit http://www.zntec.cn/"
echo ""
echo "========================================================================="
fi

保存到root目录


执行一下:


sh upgrade_tengine.sh.txt

http://www.zntec.cn/archives/upgrade_tengine.html这篇写的确实可用!搞完就开始配置虚拟主机和LNMP的使用是一样的!


升级成功,网站速度是不是快很多?



你可能感兴趣的:(服务器操作相关)