5.15、tomcat下部署JPress
阅读原文时间:2023年07月08日阅读:4

1、说明:

jpress类似于wordpress,wordpress是php语言开发的国外开源软件,jpress是java语言

开发的国内开源软件;

2、下载软件包:

[root@slave-node1 ~]# mkdir -p /tools/

[root@slave-node1 ~]# cd /tools/

(1)下载依赖软件apache-maven:

wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz

(2)下载jpress:

http://www.jpress.io/club/post/116

(3)查看下载的软件:

[root@slave-node1 tools]# ls

apache-maven-3.6.1-bin.tar.gz jpress-v2.0.4.war

3、安装:

安装前需要关闭nginx和tomcat实例;

(1)安装apache-maven:

mkdir -p /application/

tar -xzf /tools/apache-maven-3.6.1-bin.tar.gz -C /application/

ln -s /application/apache-maven-3.6.1/ /application/maven

sed -i.ori '$a export MAVEN_HOME=/application/maven\nexport PATH=$MAVEN_HOME/bin:$PATH' /etc/profile

source /etc/profile

mvn -version

Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)

Maven home: /application/maven

Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre

Default locale: zh_CN, platform encoding: UTF-8

OS name: "linux", version: "3.10.0-862.el7.x86_64", arch: "amd64", family: "unix"

(2)安装jpress:

mkdir -p /data/www/tomcat/memtest/

mv /data/www/tomcat/ROOT/* /data/www/tomcat/memtest/

cd /data/www/tomcat/ROOT/

jar -xf /tools/jpress-v2.0.4.war

[root@slave-node1 ROOT]# ls

META-INF robots.txt static templates WEB-INF

(4)授权:

chown -R tomcat.tomcat /data/www/tomcat/

4、在mysql中创建jpress数据库:

(1)安装数据库:

[root@slave-node1 ~]# yum install mariadb-server -y

[root@slave-node1 ~]# mysql_secure_installation

(2)启动数据库:

[root@slave-node1 ~]# systemctl enable mariadb

[root@slave-node1 ~]# systemctl start mariadb

(3)创建jpress数据库:

[root@slave-node1 ~]# mysql -uroot -p123456

MariaDB [(none)]> create database jpress character set utf8 collate utf8_bin;

MariaDB [(none)]> grant all on jpress.* to jpress@'172.16.1.%' identified by '123456';

MariaDB [(none)]> flush privileges;

MariaDB [(none)]> exit;

5、配置jpress:

启动tomcat 8080实例: su - tomcat /application/tomcat-8080/bin/startup.sh

(1)在浏览器中输入"http://172.16.1.91:8080/"进行配置;

(2)配置数据库:

(3)配置网站信息:

(4)登录后台:

http://172.16.1.91:8080/admin/login

6、启动tomcat 8081实例和nginx:

需要修改"/application/nginx/conf/conf.d/tomcat.conf"配置文件,添加"ip_hash;"参数;

[root@slave-node1 ~]# su - tomcat /application/tomcat-8081/bin/startup.sh

[root@slave-node1 ~]# /application/nginx/sbin/nginx

7、使用nginx负载进行访问:

http://172.16.1.91

8、jpress设置补充:

(1)数据库配置文件:

[root@slave-node1 ~]# cat /data/www/tomcat/ROOT/WEB-INF/classes/jboot.properties

#Auto create by JPress

#Fri Jul 19 21:59:38 CST 2019

jboot.datasource.url=jdbc\:mysql\://172.16.1.91\:3306/jpress?useUnicode\=true&useSSL\=false&characterEncoding\=utf8&zeroDateTimeBehavior\=convertToNull

jboot.web.jwt.secret=cc80b05b7f1a48c982a0eee676d4bb4d

jboot.web.cookieEncryptKey=61c492707bae4efda79cef250938585e

jboot.datasource.type=mysql

jboot.app.mode=product

jboot.datasource.password=123456

jboot.datasource.user=jpress

(2)上传图片存储的位置:

[root@slave-node1 ~]# ls /data/www/tomcat/ROOT/attachment/20190719/

513cc49a57624f55b404bf1e5027efaa.jpg

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器