惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
C
Cybersecurity and Infrastructure Security Agency CISA
Engineering at Meta
Engineering at Meta
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
T
Threat Research - Cisco Blogs
C
Cisco Blogs
Recent Announcements
Recent Announcements
S
Securelist
N
Netflix TechBlog - Medium
The Register - Security
The Register - Security
P
Privacy & Cybersecurity Law Blog
宝玉的分享
宝玉的分享
D
Darknet – Hacking Tools, Hacker News & Cyber Security
L
LINUX DO - 热门话题
T
Tor Project blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
月光博客
月光博客
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
博客园 - 司徒正美
L
LINUX DO - 最新话题
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
H
Help Net Security
Spread Privacy
Spread Privacy
PCI Perspectives
PCI Perspectives
Project Zero
Project Zero
I
Intezer
T
The Blog of Author Tim Ferriss
有赞技术团队
有赞技术团队
The Last Watchdog
The Last Watchdog
C
Check Point Blog
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
MyScale Blog
MyScale Blog
V
Vulnerabilities – Threatpost
Recorded Future
Recorded Future
T
Tenable Blog
Jina AI
Jina AI
D
DataBreaches.Net
阮一峰的网络日志
阮一峰的网络日志

博客园 - 周伟

域名解析文件hosts文件是什么?如何修改hosts文件? PowerDesigner 使用心得 CSV扩展类 C++导入导出CSV文件 struct+vector实现树结构 WebService 随写 mysql相关文章收集 Linux下两种自动启动Tomcat的方法 linux自动启动mysql LINUX下mysql的大小写区分设置 Jdom使用指南 vector+struct在数据接口中的应用 UML用例中使用和扩展意义 枚举和字符串互转 单件模式的C++标准实现 设计模式 Add Crash Reporting to Your Applications with the CrashRpt Library 设计模式——单键模式(singleton)C++实现 Singleton的C++实现 及相关问题
实现TOMCAT服务下一个ip绑定多域名绑定的方法
周伟 · 2010-08-24 · via 博客园 - 周伟

转载http://www.pw88.com/internetd/sort054/sort0105/3661.html

tomcat下的配置都在conf下的server.xml下实现。。。
里面从高到低分为:
Server
 --Service
  --Connector
  --Engine
   --Host
    --Context

首先把通讯接口下的PORT改为80,这样就不用在浏览器中输入端口号了,如:


<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector
port="80"               maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
HOST代表虚拟主机:
默认有

 <Host name="localhost" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
      </Host>
所以我们平时都是直接输入http://localhost/:端口号/项目名   就好了。。
假如我现在有个项目在E盘下的workspace目录,项目名为LZW
我不想部署在tomcat下的webapp目录下,而是直接想在TOMCAT下加载这个项目
并且用个域名(http://www.pw88.com/)来映射。这样我们可以加上下面这段代码
 


 <Host name="http://www.pw88com/" appBase="e:\workspace\LZW 
  unpackWARs="true" autoDeploy="true" 
  xmlValidation="false" xmlNamespaceAware="false"> 
  <Context path="" docBase="WebRoot" debug="0" reloadable="true" crossContext="true" /> 
 </Host>
appBase为项目的绝对路径,docBase为WEB目录

假如我现在的图片都放在d:\ext.lzw.com\img下,我想用个二级域名
(img.lzw.com)映射它,假如在d:\ext.lzw.com\img下放入一张图片1.jpg,我们就
可以输入img.lzw.com/1.jpg来访问它了。。加上下面代码就可以实现了。。


   <Host name="img.lzw.com" appBase="d:\ext.lzw.com\img" 
  unpackWARs="true" autoDeploy="true" 
  xmlValidation="false" xmlNamespaceAware="false"> 
  <Context path="" docBase="" debug="0" reloadable="true" crossContext="true" /> 
    </Host>
最终我们要在本地访问域名,还得修改相爱HOST文件。。打开
C:\WINDOWS\system32\drivers\etc\hosts
加上

127.0.0.1       http://www.pw88.com/
127.0.0.1       img.lzw.com