在a上操作
1、安裝openjdk
yum install java-1.8.0-openjdk-devel.x86_64
java -version ---確認(rèn)是否安裝成功
2、安裝tomcat
yum install tomcat tomcat-admin-webapps tomcat-docs-webapp tomcat-webapps
systemctl start tomcat
測試
http://172.18.21.107 ---可以訪問tomcat的默認(rèn)網(wǎng)站
3、將zrlog放到tomcat的根目錄下
mv app/zrlog-1.7.1-release.war /usr/share/tomcat/webapps
systemctl restart tomcat
[root@centos7 webapps]#ls ---發(fā)現(xiàn)文件被自動(dòng)解開
docs host-manager manager zrlog-1.7.1-release
examples logs ROOT zrlog-1.7.1-release.war
[root@centos7 webapps]#ln -s zrlog-1.7.1-release zrlog
4、安裝httpd并修改配置
yum install httpd
vim vhost.conf
<virtualhost *:80>
servername www.node2.com
documentroot /app/website1
<directory /app/website1>
require all granted
</directory>
proxyrequests off
proxypass "/" "ajp://127.0.0.1:8009/"
proxypassreverse "/" "ajp://127.0.0.1:8009/"
</virtualhost>
httpd -t
systemctl start httpd ---啟動(dòng)服務(wù)
在b上的設(shè)置
6蛉威、安裝數(shù)據(jù)庫
yum install mariadb-server
systemctl start mariadb
mysql
MariaDB [(none)]> create database zrlog;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on zrlog.* to zrloguser@'172.18.21.107' identified by "centos";
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
7、登錄網(wǎng)站
http://172.18.21.107/zrlog/
會讓輸入數(shù)據(jù)庫的一些信息猫妙,填好后安裝即可
總結(jié):如果是一個(gè).war的動(dòng)態(tài)程序文件瓷翻,只要把它放到tomcat的根目錄下,然后重啟tomcat就會自動(dòng)解開這個(gè)程序文件割坠,創(chuàng)建一個(gè)軟連接齐帚,然后就可以訪問這個(gè)程序文件了。通過反復(fù)試驗(yàn)彼哼,發(fā)現(xiàn)此動(dòng)態(tài)程序只能通過httpd反向代理对妄,并且和后端tomcat連接的協(xié)議類型為aip才可以。