WEB站点部署

时间:2019-09-23
本文章向大家介绍WEB站点部署,主要包括WEB站点部署使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

上线的代码有两种方式:

第一种方式是直接将程序目录放在webapps目录下面。

第二种方式是使用开发工具将程序打包成war包,然后上传到webapps目录下面。

使用 war 包部署 web 站点

部署 Tomcat 内存检测包

上传 meminfo.war 包到 /usr/local/tomcat/webapps 目录中

[root@localhost webapps]# ls
docs  examples  host-manager  manager  meminfo.war  ROOT

站点会主动解压部署

[root@localhost webapps]# ls
docs  examples  host-manager  manager  meminfo  meminfo.war  ROOT

部署开源站点(jpress)

jpress官网:http://jpress.io

下载地址:https://github.com/JpressProjects/jpress

安装数据库

[root@localhost ~]# yum -y install mariadb-server mariadb
[root@localhost ~]# systemctl start mariadb

配置数据库

[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> create database jpress DEFAULT CHARACTER SET utf8;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on jpress.* to jpress@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

jpress 站点上线

[root@localhost ~]# wget  https://github.com/JpressProjects/jpress/archive/0.4.0.tar.gz
[root@localhost ~]# tar xf 0.4.0.tar.gz
[root@localhost ~]# cd jpress-0.4.0/wars/
[root@localhost wars]# mv jpress-web-newest.war /usr/local/tomcat8/webapps/
[root@localhost wars]# /usr/local/tomcat8/bin/shutdown.sh 
[root@localhost wars]# /usr/local/tomcat8/bin/startup.sh 
[root@localhost wars]# ls /usr/local/tomcat8/webapps/
docs  examples  host-manager  jpress-web-newest  jpress-web-newest.war  manager  ROOT

原文地址:https://www.cnblogs.com/2567xl/p/11574339.html