1.先利用花生壳申请免费域名,这个easy啊,可以网上参考申请步骤
注册差不多就这样,
然后记得像上图那样登录花生壳
2.路由器端口映射设置
先进入路由器,一般http://192.168.1.1
我的帐号密码 admin admin123
设置标记的地方,IP地址用自己本机的 端口等下要用,最好不要设置成8009或8080 听同事说貌似电信封了这端口
3.tomcat 的server.xml文件的配置
8868为路由器里配置的端口号
这样web项目就能在外网访问了 域名:端口号/项目名
参考文章
<?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> <Server port="8005" shutdown="SHUTDOWN"> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> <Listener className="org.apache.catalina.core.JasperListener" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html --> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8866" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8866" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation --> <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> --> <Engine name="Catalina" defaultHost="xxxx.eicp.net"> <!--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="xxxx.eicp.net" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="xx" docBase="D:\apache-tomcat-6.0.29\webapps\xx" reloadable="true" crossContext="true"></Context> </Host> </Engine> </Service> </Server>
相关推荐
很适合学习使用,希望对初学JavaEE WEB开的人有所帮助。 4、本版本全面更新了jar包,全部使用了当前最新版本的jar包,struct2.1.8 spring3 hibernate3.5,全面使用注解取代xm的l配置。 5、另外增加了一个ant构建脚本...
javaEE web 应用JAR包javaEE web 应用JAR包javaEE web 应用JAR包javaEE web 应用JAR包
JAVAEE期末项目总结报告.doc
IntelliJ IDEA 12创建Maven管理的JavaEE Web项目.pdf
使用验证码,增强用户体验效果,使你的网页更具有特色
JavaEE+项目案例+(代码+数据库)
教你如何创建第一个javaee的web项目
《JavaEE编程课程设计》期末项目报告书.docx《JavaEE编程课程设计》期末项目报告书.docx《JavaEE编程课程设计》期末项目报告书.docx《JavaEE编程课程设计》期末项目报告书.docx《JavaEE编程课程设计》期末项目报告书...
javaee-web相关
javaEE-web的文件路径, 用getClass().getResourceAsStream("/")来确定文件路径 并用jdom读取xml和下载1
myeclipse导出javaee web项目失败---(10.7版本的myeclipse) 一般来说导出时报错,然后myeclipse会关闭并且弹出一个错误页面 解决myeclipse导出javaee项目失败导致的问题,一般来说可能是盗版的myeclipse用破解工具...
在线订购子系统(JSP+JavaBean)
教学课件,关于javascript\jsp\servlet\struts,etc.
一个完整的JavaEE项目流程,其中包含代码
大学javaee web 大作业~~ NIT版本
基于JavaEE的Web开发技术.ppt
几种常见的JavaEE Web容器集群技术比较
Javase javaee web开发所需要的API 中文版,中文版本
基于lucene的开发JavaEE项目 基于lucene的开发JavaEE项目 基于lucene的开发JavaEE项目 基于lucene的开发JavaEE项目 基于lucene的开发JavaEE项目
Java+EE说明精通JavaEE项目案例 Java+EE说明精通JavaEE项目案例 Java+EE说明精通JavaEE项目案例 没有源码