posts - 0, comments - 77, trackbacks - 0, articles - 356
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          Tomcat域名配置

          Posted on 2007-09-07 16:06 semovy 閱讀(656) 評論(0)  編輯  收藏 所屬分類: J2EE綜合

          打開tomhome/conf/下的server.xml

          添加以下內容:

          <Host appBase="C:/aaaa" autoDeploy="true" debug="0" deployXML="true" liveDeploy="true" name="www.xxxxxxxx.com" unpackWARs="true">
          <Context cachingAllowed="true" cookies="true" crossContext="true" debug="0" docBase="C:/aaa/bbb" path="" privileged="false" reloadable="true" swallowOutput="false" useNaming="true" >
          </Context>
          </Host>
          僅僅這樣還是不夠的,配置后,現在輸入http://localhost:8080/以及你的IP:8080是沒有問題,可是要想從外網訪問就必需配置你的hosts文件了。

          windows服務器在:C:\WINNT\system32\drivers\etc\下,直接用記事本打開就可以了
          例:

          # Copyright (c) 1993-1999 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

          127.0.0.1        localhost
          *.*.*.*           www.***.com

          linux服務器在/etc/下,命令行下:vi hosts

          例:
          # Do not remove the following line, or various programs
          # that require network functionality will fail.
          127.0.0.1        localhost.localdomain    localhost        lkpor1
          *.*.*.*           www.***.com

          如果在Tomcat下面配置域名(如:www.***.com)的時候,同時又不希望客戶通過我們網站的IP或者域名訪問到Tomcat默認的ROOT,配制方法如下:
          1、打開Tomcat安裝目錄下的\conf\server.xml文件
          2、在server.xml中將原有的<Host name=“localhost“ appBase=“webapps“ ……>修改為<Host name=“您要配置的域名“ appBase=“webapps“……>
          3、在\conf\Catalina目錄下建立目錄“<您要配置的域名的名稱>”,然后建立ROOT.xml文件,其格式和\conf\localhost目錄下的ROOT.xml一致,但是內容如下:
             <?xml version='1.0' encoding='utf-8'?>
             <Context displayName="Welcome to 56World!" docBase="D:\workplace\inbuilding" path="">
             </Context>
          其中docBase中的內容就是你希望的打開您的域名(www.***.com) 的時候映射到的目錄和默認的網頁(如:index.jsp)
          4、啟動Tomcat服務器,就可以直接敲入域名訪問你要訪問的地址了。
          主站蜘蛛池模板: 织金县| 乌拉特前旗| 康平县| 南丹县| 巫山县| 三门县| 乌拉特后旗| 黄大仙区| 嘉定区| 达孜县| 禄丰县| 女性| 红桥区| 玉树县| 河东区| 宁津县| 岑溪市| 建德市| 定襄县| 灵丘县| 德江县| 达日县| 犍为县| 旺苍县| 吴江市| 兴文县| 长汀县| 岚皋县| 元朗区| 瓦房店市| 两当县| 宝清县| 松滋市| 莎车县| 调兵山市| 竹山县| 咸宁市| 美姑县| 新和县| 黔南| 唐山市|