zoukankan      html  css  js  c++  java
  • Redhat 7 安装tomcat 服务器

     

    安装tomcat服务器必须要有jdk的支持,安装jdk的步骤:

    https://blog.csdn.net/wlh525/article/details/98638418

    一、官网下载

    1、官网地址:http://tomcat.apache.org/

    下载:apache-tomcat-8.5.41.tar.gz

    找到相应的版本之后点击,在出现的页面中选择bin,即可下载相应的版本

    2、下载之后使用rz命令上传到虚拟机中的linux主机中

    1. # cd /opt/program # 前提是你已经建立了program这个目录
      
      # mkdir tomcat
       
      # cd tomcat
       
      # rz
       
      # ls # 查看

    3、解压

    # tar -zxvf apache-tomcat-8.5.41.tar.gz

    4、tomcat 默认端口是8080,要想浏览器可以访问必须得打开防火墙的8080端口

    # firewall-cmd --add-port=8080/tcp #开启端口
    #如果需要永久开放端口,使用下面的命令
     firewall-cmd --zone=public --add-port=8080/tcp --permanent # firewall
    -cmd --list-ports #查看打开的端口

    # firewall-cmd --reload #重启防火墙

    5、启动tomcat

    1. 手动启动tomcat
    # cd /opt/program/tomcat/apache-tomcat-8.5.41/bin/
     
    # ./startup.sh

       2.开机启动tomcat,需要修改/etc/rc.local

    /bin/bash /opt/program/tomcat/apache-tomcat-8.5.41/bin/startup.sh

      

    6、页面输入:http://192.168.148.131:8080即可访问(IP地址为linux主机的IP地址)

    默认打开的页面为/opt/program/tomcat/apache-tomcat-8.5.41/webapps/ROOT下的文件,我们看到的欢迎页面实际上是在安装路径/opt/program/tomcat/apache-tomcat-8.5.41/conf/web.xml里指定的,在这三行里从上往下扫描,因为/opt/program/tomcat/apache-tomcat-8.5.41/webapps/ROOT不存在index.html文件,所以我们看到的欢迎界面其实是index.jsp

    1. <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
    2.  
      配置监听端口,需要修改tomcat/conf/server.conf文件。
      <Server port="8005" shutdown="SHUTDOWN">

      可以将8005修改为自己需要的端口。

  • 相关阅读:
    自制404页面
    Http错误代码含义
    数据访问基础类(基于Access数据库)
    NTILE函数在SQL Server 2000中的实现方法
    矩阵螺旋输出
    分区排名方案和排名值效率分析【图文+测试代码】
    安装eclipse axis2 插件(links 方式)
    perforce关闭服务后无法重启
    A4纸网页打印中对应像素的设定和换算
    2005数据库脚本在SQL2000上执行
  • 原文地址:https://www.cnblogs.com/ityunwei/p/13665043.html
Copyright © 2011-2022 走看看