运维网监控突然同事反应,在百度上搜索其他域名,竟然打开了和我们P2P一模一样的网站,我第一个反应是源代码被盗用了。后来发现,是域名被恶意解析了,解决方法 1、禁止IP地址访问项目  2、只允许指定的域名访问。

 环境:tomcat 6
方法: 修改tomcat 6 的配置文件 tomcat/conf/server.xml,实现原理,将tomcat 缺省参数defaultHost指向一个不存在的域名上,并添加同样的虚拟目录,这样当被一个未知的域名解析过来后,访问的缺省虚拟目录,但这个目录中并没有任何项目,这样就达到效果了。
以下是我配置文件参数 只贴出 Engine 之间的哦~ <Engine name="Catalina" defaultHost="192.168.1.1"> <!-- 缺省参数我设置的是我服务器的外网IP地址 -->
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- The request dumper valve dumps useful debugging information about
the request and response data received and sent by Tomcat.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name=www.abc.com appBase="webapps" <!-- 这个虚拟目录是你真实使用的虚拟目录,域名也是你指定的域名 -->
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/home/web/apache-tomcat-6.0.39/webapps/abc" debug="0" reloadable="true"/> <!-- 指定虚拟目录的项目地址 -->
</Host> <Host name="192.168.1.1" appBase="ipapps" <!-- 设置你服务器的外网IP地址,并建立一个虚假的虚拟目录 ipaaps 这个是不存在的,当访问IP地址或其他域名,将被转向到访问这个虚拟目录上 -->
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host> </Engine>

最新文章

  1. ExtJs
  2. jquery 行交换 上移 下移
  3. mysql之字符集与校对集
  4. 当分页语句遇到union all
  5. asp.netGridView使用技巧
  6. java多线程核心技术——第四章总结
  7. Python进阶内容(五)--- type和object的关系
  8. loadrunner中如何将MD5加密的值转换为大写
  9. Maven pom.xml简单归结
  10. 【微信小程序项目实践总结】30分钟从陌生到熟悉
  11. arale-cookie 使用
  12. 用最简单的话告诉你什么是ElasticSearch
  13. loadrunner&#160;脚本优化-参数化之Parameter&#160;List参数同行取值
  14. Maya中提交Nuke工程到deadline中的方法
  15. (五)ROS节点
  16. Python环境下如何安装爬虫需求的一些库
  17. HDS TrueCopy-数据远程容灾白皮书-IOPS数据
  18. 20145122 《Java程序设计》第8周学习总结
  19. 如何在Markdown文档中插入空格?
  20. Android Bitmap

热门文章

  1. Linux中的bin文件夹
  2. BiNGO的GO分析
  3. Python常用内置函数整理(lambda,reduce,zip,filter,map)
  4. SQL SERVER内部函数大全
  5. PHPthink 配置目录
  6. PHP curl_multi_add_handle函数
  7. 【LeetCode 42】接雨水
  8. BUUCTF | [SUCTF 2019]EasySQL (堆叠注入)
  9. [CSP-S模拟测试]:Set(随机化)
  10. Java中static修饰类的问题