Tomcat搭建
https://tomcat.apache.org/官网下载Toncat
1,查看JDK是否安装
[[email protected] ~]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
2,安装配置Tomcat
本次使用apache-tomcat-8.5.41
1)解包
[[email protected] ~]# tar zxf apache-tomcat-8.5.41.tar.gz
2)解压后的文件夹移动到/usr/local下,并改名为tomcat8
[[email protected] ~]# mv apache-tomcat-8.5.41 /usr/local/tomcat8
3)启动tomcat
[[email protected] ~]# /usr/local/tomcat8/bin/startup.sh
查看8080端口监听信息
3,打开浏览器http://localhost:8080/出现下图,即启动成功
如果想要要关闭tomcat,则运行/usr/local/tomcat8/bin/shutdown.sh
4,创建一个web路径,例如/web/html
修改Tomcat的server.xml文件,定义一个虚拟主机,并将网站文件路径指向/web/tomcat,在host字段增加Context段
[[email protected]ost ~]# vim /usr/local/tomcat8/conf/server.xml
然后关闭tomcat在启动,重新访问