• tomcat配置虚拟主机


    tomcat虚拟主机用于在一台主机上搭建多个web站点,每个站点独立运行,互不干扰,基于域名配置虚拟主机,要具有解析功能或修改本机的hosts文件

    1.将之前备份的主配置文件覆盖掉

    cd /usr/local/tomcat8/conf/

    2.进行还原

    cp server.xml.bak server.xml

    3.重启服务

    /usr/local/tomcat8/bin/shutdown.sh && /usr/local/tomcat8/bin/startup.sh

    4.进入网页进行测试,回到初始状态

    以上步骤在tomcat实施了其他操作的时候进行修改,若刚安装tomcat则直接进行以下操作 

    5.修改配置文件

    vim server.xml

    将末尾的<Host></Host>段进行复制

    6.修改内容

         Host name="对应的域名"

         添加  <Context docBase="/web/a" path="" raloadbles="flase"/>

            <Context docBase="/web/b" path="" raloadbles="flase"/>

                      用来指定网页存放位置

    7.在/web/创建两个a,b两个文件

    mkdir /web/{a,b}

    8.分别在两个文件中创建两个index.jsp的测试页

    cd a

    vim index.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <html>
    <head>
    <title>JSP test page</title>
    </head>
    <body><%out.println("Welcome come to test site,http://www.a.com");%>
    </body>
    </html>

    cd b

    vim index.jsp

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <html>
    <head>
    <title>JSP test page</title>
    </head>
    <body><%out.println("Welcome come to test site,http://www.b.com");%>
    </body>
    </html>

    9.重启服务

    /usr/local/tomcat8/bin/shutdown.sh && /usr/local/tomcat8/bin/startup.sh

    10.进入网页进行测试

  • 相关阅读:
    Creating fields using CSOM
    WCF Misconfiguration: Security Not Enabled
    WCF Misconfiguration: Insufficient Audit Failure Handling
    ASP.NET Misconfiguration: Excessive Session Timeout
    ASP.NET Misconfiguration: Missing Error Handling
    ASP.NET Misconfiguration: Request Validation Disabled
    ASP.NET Misconfiguration: Debug Information
    MIME Sniffing
    web.config中的HttpCookie.HttpOnly属性
    How to: Convert Between Various String Types
  • 原文地址:https://www.cnblogs.com/990114-jhc/p/11583257.html
Copyright © 2020-2023  润新知