访问控制
首先安装好jdk以及apache-tomcat并能访问tomcat网页
点击server status了解服务状态会报403的错误
第一步:修改user.xml配置文件
[root@localhost ~]# vim /usr/local/tomcat8/conf/tomcat-users.xml
在最后面添加如下三行
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>
第二步:修改context.xml配置文件
[root@localhost ~]# vim /usr/local/tomcat8/webapps/manager/META-INF/context.xml
注释掉Valve部分
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />-->
[root@localhost ~]# /usr/local/tomcat8/bin/startup.sh //启动tomcat服务
再次点击server status会进入状态页面
站点部署(一般由开发人员给的一个war包,再由运维搭建服务上传war包)
war包放在/usr/local/tomcat8/webapps/下
[root@localhost webapps]# rz -E //上传 jpress-web-newest.war 包
z waiting to receive.**B0100000023be50
[root@localhost webapps]# rz -E //上传 meminfo.war包
z waiting to receive.**B0100000023be50
两个包都必须放在webapps下
[root@localhost webapps]# ls
docs examples host-manager jpress-web-newest jpress-web-newest.war manager meminfo meminfo.war ROOT
此处为数据库所有的安装mysql以此进入
安装mysql
[root@localhost yum.repos.d]# yum -y install mariadb mariadb-server
[root@localhost ~]# systemctl start mariadb //启动mariadb数据库服务
[root@localhost ~]# mysql //进入数据库创建用户名和密码
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.7++
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database lx; //创建新用户lx的数据库
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on lx.* to 'lx'@'localhost' identified by'123456';\ //授予所有权限对lx的所有表@从localhost登录,密码为123456
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges; //flush privileges刷新MySQL的系统权限相关表
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
[root@localhost ~]# /usr/local/tomcat8/bin/shutdown.sh
[root@localhost ~]# /usr/local/tomcat8/bin/startup.sh
在输入栏再加一个admin
用户名和密码都是admin