>> 软件清单
jdk6
tomcat
memcached
activemq
nginx(已装)
ps:未注明版本号的,用最新的稳定版即可。
未注明安装位置的,均安装在指定目录(这里是/usr/local/cellar)
一些软件的操作脚本在/usr/local/etc/rc.d下
>> 安装步骤
jdk6
* 检查服务器是否已安装过sun jdk,有则跳过此步骤.
* 从官网下载jdk-6u27-linux-i586.bin
* # mkdir /usr/java
* # ./jdk-6u27-linux-i586.bin 执行后将解压后的jdk1.6.0_27移到/usr/java/下.
* # vi /etc/profile 添加
export JAVA_HOME=/usr/java/jdk1.6.0_27
export CLASS_PATH=.:%JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
* source /etc/profile 生效
tomcat
* 下载并解压
#wget http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-7/v7.0.22/bin/apache-tomcat-7.0.22.tar.gz
#tar zxvf apache-tomcat-7.0.22.tar.gz -C /usr/local/cellar/
#mv apache-tomcat-7.0.22 tomcat
* 启动tomcat
/usr/local/cellar/tomcat/bin/startup.sh
* 关闭tomcat
/usr/local/cellar/tomcat/bin/shutdown.sh
memcached
* 下载并解压
# wget http://memcached.googlecode.com/files/memcached-1.4.8.tar.gz
# tar zxvf memcached-1.4.8.tar.gz
# 编译安装 ./configure --pri;make;make install
* 启动 11211 11212 两个端口服务
/usr/local/cellar/memcached -d -u www -m 64 -l 127.0.0.1 -t 2 -p 11211-P /var/run/mem.pid
/usr/local/cellar/memcached -d -u www -m 64 -l 127.0.0.1 -t 2 -p 11212-P /var/run/mem.pid2
activemq
* 下载并解压
# wget http://labs.renren.com/apache-mirror//activemq/apache-activemq/5.5.0/apache-activemq-5.5.0-bin.tar.gz
# tar zxvf apache-activemq-5.5.0-bin.tar.gz -C /usr/local/cellar/
# mv apache-activemq-5.5.0 activemq
* 启动activemq
# /usr/local/cellar/activemq/bin/linux-x86-64/activemq start
* 关闭activemq
# /usr/local/cellar/activemq/bin/linux-x86-64/activemq stop
>> 配置
项目代码
/usr/deploy/testhall
|-doc
|-src
|-WebContent
nginx
* 配置文件添加
upstream backserver{
ip_hash;
server 127.0.0.1:8080;
}
server{
listen 80;
server_name hall.clmobi.net;
index /testhall/index.do; #设定访问的默认首页地址
root /usr/deploy/testhall/WebContent;
charset utf-8;
location ~ ^/testhall/static/(.*)$
{
alias /usr/deploy/testhall/WebContent/static/$1;
expires 1d;
break;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
location ~ /WEB-INF/ {
deny all;
break;
}
location ~ ^/testhall/
{
index index.do;
proxy_pass http://backserver; #转向tomcat处理
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
break;
}
location /NginxStatus {
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file authen/htpasswd;
}
location /resource {
root /usr/deploy/testhall/WebContent;
}
location / {
root /usr/deploy/testhall;
index index.html index.htm;
}
location ~ /\.ht {
deny all;
}
}
tomcat
# cd /usr/local/cellar/tomcat/webapps
# ln -s /usr/deploy/testhall/WebContent testhall
# cd testhall
# mkdir -p /var/hall/node/resource
# ln -s /var/hall/node/resource