Configure Tomcat's virtual host and build java application (I)

Requirement: use Tomcat to deploy a Java application (zrlog blog).

Add a virtual host

[root@dl-001 src]# vim /usr/local/tomcat/conf/server.xml         //Add the following configuration

<Host name="www.123.cn" appBase=""
    unpackWARs= "true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="/data/wwwroot/123.cn/" debug="0" reloadable="true" crossContext="true"/>
</Host>

Download zrlog-1.7.1 and cp to the specified directory

[root@dl-001 src]# wget http://dl.zrlog.com/release/zrlog-1.7.1-baaecb9-release.war

[root@dl-001 src]# ls /usr/local/tomcat/webapps/
docs  examples  host-manager  manager  ROOT

[root@dl-001 src]# ls
 zrlog-1.7.1-baaecb9-release.war

[root@dl-001 src]# cp zrlog-1.7.1-baaecb9-release.war /usr/local/tomcat/webapps/

[root@dl-001 src]# ls /usr/local/tomcat/webapps / / / you can see that there is an additional directory and it is automatically decompressed
docs      host-manager  ROOT                         zrlog-1.7.1-baaecb9-release.war
examples  manager       zrlog-1.7.1-baaecb9-release

Modify the name of zrlog

[root@dl-001 webapps]# mv zrlog-1.7.1-baaecb9-release zrlog / / to prevent automatic decompression again, just change the name.
[root@dl-001 webapps]# ls
docs      host-manager  ROOT   zrlog-1.7.1-baaecb9-release
examples  manager       zrlog  zrlog-1.7.1-baaecb9-release.war

Using browser to access zrlog

Note: mysql users are required as shown in the figure above

Check whether Mysql starts

[root@dl-001 webapps]# ps aux |grep mysql
root      1430  0.0  0.1 115392  1484 ?        S    10:40   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/dl-001.pid
mysql     1775  0.0 44.5 1038596 449452 ?      Sl   10:40   0:19 /usr/local/mysql/bin/mysqd --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/dl-001.err --pid-file=/data/mysql/dl-001.pid --socket=/tmp/mysql.sock
root      3625  0.0  0.0 112680   972 pts/0    R+   19:37   0:00 grep --color=auto mysql

Creating zrlog related databases and users

[root@dl-001 webapps]# mysql -uroot -p'mysqldl991124'    //Enter mysql
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.35 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database zrlog;        //Create the zrlog database;
Query OK, 1 row affected (0.00 sec)


mysql> grant all on zrlog.* to 'zrlog'@'127.0.0.1' identified by 'mysqldl991124';        //Create user
Query OK, 0 rows affected (0.13 sec)

mysql> quit
Bye

See if the created user is correct

[root@dl-001 webapps]# mysql -uzrlog -h127.0.0.1 -p'mysqldl991124'        //Correct
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.35 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Fill in information on Browser

Note: after filling in, click Next

Note: fill in the password and title, and then click Next

Note: Click to view

Note: at this time, the blog can write a post!!!

Tags: MySQL Oracle Tomcat Database

Posted on Tue, 05 May 2020 16:13:59 -0400 by babybird11