resin配置

安装JDK

JDK是整个JAVA的核心,包括了java的运行环境,工具和基础类库。

cd /usr/local/src/

wgethttp://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-x64.tar.gz?AuthParam=1516272146_f541266466f849853f0336cf675c5b39

官网下载的1.8.0_162版本

tar zxvf jdk-8u162-linux-x64.tar.gz?AuthParam=1516272146_f541266466f849853f0336cf675c5b39

mv jdk1.8.0_162 /usr/local/jdk1.8

设置环境变量

vim /etc/profile

JAVA_HOME=/usr/local/jdk1.8/

JAVA_BIN=/usr/local/jdk1.8/bin

JRE_HOME=/usr/local/jdk1.8/jre

PATH=$PATH:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/jre/bin

CLASSPATH=/usr/local/jdk1.8/jre/lib:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib/charsets.jar

执行如下命令生效

source /etc/profile

检验设置是否正确

java -version

显示如下内容说明配置正确

java version "1.8.0_162"

Java(TM) SE Runtime Environment (build 1.8.0_162-b12)

Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)


安装resin

wget http://a.lishiming.net/data/resin-4.0.45.tar.gz

tar zxvf resin-4.0.45.tar.gz

cd resin-4.0.45

./configure --prefix=/usr/local/resin  --with-java-home=/usr/local/jdk1.8

make && make install

 

启动resin

/etc/init.d/resin start

ps aux |grep resin

netstat -lnp 都可以查看resin是否成功启动

 

配置resin

cd /usr/local/resin/conf/

结构:

<cluster id="app"><host></host></cluster>虚拟主机配置就在<host></host>里配置

<host id="www.123.com"root-directory=".">

     <web-app id="/" root-directory="/tmp/123"/>

</host>

 

vim /tmp/123/111.jsp

<html><body><center>

Now time is:<%=new java.util.Date()%>

</html></body></center>

 

curl -x127.0.0.1:8080 www.123.com/111.jsp

<html><body><center>

Now time is:Sun Jan 21 22:09:56 CST 2018

</html></body></center>

解析成功

修改端口号在此文件内修改

vim resin.properties

 

nginx 代理resin

 

vim /usr/local/nginx/conf/nginx.conf

在最后的 } 前加入

include vhosts/*.conf;

虚拟主机配置

vim /usr/local/nginx/conf/vhosts/proxy.conf

server{

       server_name www.123.com;

       location / {

                proxy_passhttp://localhost:8080/;

                proxy_set_header Host   $host;

                proxy_set_header X-Real-IP      $remote_addr;

                proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;

       }

}

/usr/local/nginx/sbin/nginx -t

/etc/init.d/nginx restart

重启nginx,在网页输入www.123.com/111.jsp访问成功

成功用nginx代理80端口

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值