• 利用tomcat配置网站


    1: 首先将tomcat考到C盘;

    2:建立我们存放web应用的目录,我建立在D:myWeb  ,然后将自己的web应用考到myWeb目录下:

    3:wApp的目录结构为:

    WEB-INF: 结构:

    web.xml:  配置默认的主页:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                          http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0"> 
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
        </welcome-file-list>
    
    </web-app>
    

      

    4:在C:apache-tomcat-7.0.5conf  中配置server.xml

      <Host name="www.gbx.com"  appBase="D:myWeb">
    	<Context path="" docBase="D:myWebwApp" />
          </Host>
    

      

    5: 由于我们的网站没有在DNS注册,所以只能修改Windows里面的配置:

    C:WindowsSystem32driversetchosts 

    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    
    # localhost name resolution is handled within DNS itself.
    #	127.0.0.1       localhost
    #	::1             localhost
    192.168.1.104 www.gbx.com
    

      

    6: 此时在浏览器里面只要我们键入:http://www.gbx.com/   就会访问到我们配置的主页了

  • 相关阅读:
    weex 安装过程中遇到的坑
    css3 实现瀑布流
    Apache Commons工具集简介(转)
    关于val(),text(),html()的用法
    由获取子元素的方法find和children所获
    JS中判定问题
    EasyUI中dialog中嵌入form细节问题记录
    EasyUi中的datagird中a标签的click事件无法触发?(已解决)
    JSP中EL表达式取值问题记录(已解决)
    JSONObject转换JSON之将Date转换为指定格式(转)
  • 原文地址:https://www.cnblogs.com/E-star/p/3495843.html
Copyright © 2020-2023  润新知