1、准备工作
OS:CentOS Linux release 7.5.1804 (Core)
下载地址:
https://developer.ibm.com/wasdev/downloads/#asset/runtimes-wlp-javaee8
JDK
官网下载安装jdk1.8
Nginx
http://nginx.org/en/download.html
2、安装Liberty
安装JDK
[root@k14 ~]# rpm -ivh jdk-8u121-linux-x64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:jdk1.8.0_121-2000:1.8.0_121-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
解压下载的Liberty压缩包到安装目录
[root@k14 ~]# unzip wlp-javaee8-19.0.0.2.zip -d /usr/local/was
启动默认实例
[root@k14 ~]# /usr/local/was/wlp/bin/server start
Starting server defaultServer.
Server defaultServer started with process ID 2967.
启动成功,但是现在还访问不了,因为默认监听在127.0.0.1 的9080端口,所以需要安装个nginx反向代理
3、安装nginx
下载nginx源码包,编译安装
先安装依赖
[root@k14 nginx-1.14.2]# yum install -y gcc-c++ pcre-devel zlib-devel
编译安装
[root@k14 nginx-1.14.2]# ./configure --prefix=/usr/local/nginx && make && make install
设置反向代理
[root@k14 nginx-1.14.2]# vim /usr/local/nginx/conf/nginx.conf
.
location / {
root html;
index index.html index.htm;
#location里面增加一行
proxy_pass http://127.0.0.1:9080;
}
启动nginx
[root@k14 was]# /usr/local/nginx/sbin/nginx
打开测试,起来了
4、发布应用程序
这里以jenkins为例
先停止Liberty
[root@k14 was]# /usr/local/was/wlp/bin/server stop
把war包放到defaultServer下的dropins目录下,启动Liberty即可
[root@k14 was]# mv jenkins.war /usr/local/was/wlp/usr/servers/defaultServer/dropins/
[root@k14 was]# /usr/local/was/wlp/bin/server start
Starting server defaultServer.
Server defaultServer started with process ID 12275.
启动成功,使用http://192.168.1.14/项目名 即可访问
完成
原文地址:https://blog.51cto.com/niubdada/2366812