yum –y list java*
yum -y install java-1.8.0-openjdk*
解压命令:html
tar -xzvf apache-tomcat-8.5.46.tar.gz
1.在tomcat目录下找到server.xmljava
2.将8080改成80,保存web
3.设置防火墙,开放80端口shell
firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --query-port=80/tcp firewall-cmd --reload firewall-cmd --list-port --zone #做用域 --add-port=80/tcp #添加端口,格式为:端口/通信协议 --permanent #永久生效,没有此参数重启后失效
4.添加安全组规则apache
阿里云控制台 => 云服务器 => 网络与安全 => 安全组 => 配置规则centos
在浏览器地址栏输入云服务器的公网ip就能访问tomcat了浏览器
阿里云控制台 => 域名 => 解析 => 添加记录tomcat
这样就能经过域名访问了安全
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <welcome-file-list> <welcome-file>yamaxun.html</welcome-file> <!--首页--> </welcome-file-list> </web-app>
这样就能经过:域名/项目名,访问啦!不过网站还要备案才行(T_T)服务器