SSH安装之EcShop(支持伪静态)

2011年3月8日 | 分类: Linux | 标签: , , , , , , , , , , ,

环境是CentOS 5.5+LNMP,弄了个脚本安装,支持后台开启伪静态。

wget http://www.yishanhome.com/wp-content/uploads/2011/03/ecshop.sh;sh ecshop.sh


ecshop.sh代码如下

?Download ecshop.sh
#!/bin/bash
array=(http://download.ecshop.com/272/ECShop_V2.7.2_UTF8_Release0604-110307.zip http://download.ecshop.com/2.7.2/ECShop_V2.7.2_GBK_Release0604.zip)
length=${#array[@]}
usage()
{
clear
printf "
#This is a Shell-Based tool
# Author: yishan
# Website: http://www.yishanhome.com
"
for ((i=0; i<$length; i++))
do
let "m = $i + 1"
echo "$m. ${array[$i]}"
done
echo ""
option=0
read -p "Please input your option:" option
let "option = $option + 0"
  if [ "$option" -eq "0" ] || [ "$option" -gt "$length" ] ; then
    usage
  fi
}
 
check_source()
{
  echo "checking $1"
  httpvalue=`wget -nv --spider $1 2>&1|sed q|awk '{print $1}'`
  if [ -z $httpvalue ]; then
    echo "OK!"
  else
    echo "NOT accessible, please check"
    exit
  fi
}
 
input_domain()
{
  read -p "Please input domain:" domain
  if [ "$domain" = "" ]; then
  input_domain
  fi
}
www_dir=/home
usage
let "option = $option - 1"
down_url=${array[$option]}
down_file=$(echo $down_url | awk -F\/ '{print $NF}')
sitecode=$(echo $down_file | awk -F\. '{print $1}')
echo $array
echo $down_url
echo $down_file
echo $sitecode
check_source $down_url
mkdir $HOME/$sitecode
mkdir $www_dir/$sitecode
mkdir /usr/local/nginx/conf/vhost
input_domain
wget $down_url
 
if echo $down_file|grep -q .zip;then
unzip $down_file -d $HOME/$sitecode
fi
 
if echo $down_file|grep -q .tar.gz;then
tar -zxvf $down_file -C $HOME/$sitecode
fi
 
mv $HOME/$sitecode/upload/* $www_dir/$sitecode/
cd $www_dir/$sitecode/
chmod 777 data -R
chmod 777 temp -R
chmod 777 cert -R
chmod 777 includes -R
chmod 777 images -R
chmod 777 themes -R
 
cat > /usr/local/nginx/conf/$sitecode.conf <<EOF
if (!-e \$request_filename)
{
rewrite "^/index\.html" /index.php last;
rewrite "^/category$" /index.php last;
rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=\$1 last;
rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=\$1 last;
rewrite "^/feed\.xml$" /feed.php last;
rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=\$1&brand=\$2&price_min=\$3&price_max=\$4&filter_attr=\$5&page=\$6&sort=\$7&order=\$8 last;
rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=\$1&brand=\$2&price_min=\$3&price_max=\$4&filter_attr=\$5 last;
rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=\$1&brand=\$2&page=\$3&sort=\$4&order=\$5 last;
rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=\$1&brand=\$2&page=\$3 last;
rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=\$1&brand=\$2 last;
rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=\$1 last;
rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=\$1 last;
rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=\$1&page=\$2&sort=\$3&order=\$4 last;
rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=\$1&page=\$2 last;
rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=\$1 last;
rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=\$1 last;
rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=\$1&cat=\$2&page=\$3&sort=\$4&order=\$5 last;
rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=\$1&cat=\$2&page=\$3 last;
rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=\$1&cat=\$2 last;
rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=\$1 last;
rewrite "^/tag-(.*)\.html" /search.php?keywords=\$1 last;
rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=\$1 last;
rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=\$1 last;
rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=\$1 last;
rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=\$1&act=view last;
rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=\$1&integral_min=\$2&integral_max=\$3&page=\$4&sort=\$5&order=\$6 last;
rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=\$1&page=\$2&sort=\$3&order=\$4 last;
rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=\$1&page=\$2 last;
rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=\$1 last;
 
 
}
EOF
 
cat > /usr/local/nginx/conf/vhost/$domain.conf <<EOF
server
        {
                listen       80;
                server_name $domain;
                index index.html index.htm index.php default.html default.htm default.php;
                root  $www_dir/$sitecode;
                include $sitecode.conf;
                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }
 
                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }
 
                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }
 
                access_log off;
        }
EOF
 
/usr/local/nginx/sbin/nginx -s reload

安装完成请记住删除安装文件及演示文件

rm -f -R /home/ECShop_V2/install
rm -f -R /home/ECShop_V2/demo

演示:http://ecshop.yishanhome.com

目前还没有任何评论.

返回顶部