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

来源:互联网 发布:黄一琳淘宝店质量如何 编辑:程序博客网 时间:2024/06/04 08:00

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

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

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

Apache+Nginx重新换回Tengine. 


大致的步骤:


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


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


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

使用。

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


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


升级脚本如下:


#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATH# Check if user is rootif [ $(id -u) != "0" ]; then    echo "Error: You must be root to run this script, please use root to install lnmp"    exit 1ficlearecho "========================================================================="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_versionif [ "$1" != "--help" ]; then#set nginx versionnginx_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_versionif [ "$nginx_version" = "" ]; thenecho "Error: You must input tengine version!!"exit 1fiecho "==========================="echo "You want to upgrade tengine version to $nginx_version"echo "==========================="get_char(){SAVEDSTTY=`stty -g`stty -echostty cbreakdd if=/dev/tty bs=1 count=1 2> /dev/nullstty -rawstty echostty $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 ]; thenecho "Download tengine-$nginx_version.tar.gz successfully!"  elseecho "WARNING!May be the tengine version you input was wrong,please check!"echo "tengine Version input was:"$nginx_versionsleep 5exit 1  fifiecho "============================check files=================================="echo "Stoping MySQL..."/etc/init.d/mysql stopecho "Stoping PHP-FPM..."/etc/init.d/php-fpm stopif [ -s /etc/init.d/memceached ]; then  echo "Stoping Memcached..."  /etc/init.d/memcacehd stopfirm -rf tengine-$nginx_version/tar zxvf tengine-$nginx_version.tar.gzcd 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-ipv6makemv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.oldcp objs/nginx /usr/local/nginx/sbin/nginx/usr/local/nginx/sbin/nginx -tmake upgradeecho "Upgrade completed!"echo "Program will display Nginx Version......"/usr/local/nginx/sbin/nginx -vcd ../echo "Restarting Nginx..."/etc/init.d/nginx restartecho "Starting MySQL..."/etc/init.d/mysql startecho "Starting PHP-FPM..."/etc/init.d/php-fpm startif [ -s /etc/init.d/memceached ]; then  echo "Starting Memcached..."  /etc/init.d/memcacehd startfiecho "========================================================================="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的使用是一样的!


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



0 0
原创粉丝点击