1、注册账号
https://www.ngrok.cc/
2、开通一个隧道账号
记录一下隧道ID 33adb03ff15e3705
3、下载客户端,最下面
https://www.ngrok.cc/
windows64下载
http://pan.baidu.com/s/1o8HQHxo
4、解压双击,输入33adb03ff15e3705按回车即可
注意:使用使用80端口可以省略不写。
比如 localhost:8080/TestDemo/index.jsp
在server.xml中设置端口为80的时候即
localhost/TestDemo/index.jsp
当然设置其他端口也可以,不过不能省略,Ip地址也可以为其他内网IP地址。
比如192.168.1.100:9999
5、使用Tomcat作为本地服务器
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN"><Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener" /><Listener className="org.apache.catalina.core.JasperListener" /><Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /><Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /><Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /><GlobalNamingResources><Resource auth="Container" description="User database that can be updated and saved"factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase"pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase" /></GlobalNamingResources><Service name="Catalina"><Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1"redirectPort="8443" /><Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /><Engine defaultHost="localhost" name="Catalina"><Realm className="org.apache.catalina.realm.LockOutRealm"><Realm className="org.apache.catalina.realm.UserDatabaseRealm"resourceName="UserDatabase" /></Realm><Host appBase="webapps" autoDeploy="true" name="localhost"unpackWARs="true"><Valve className="org.apache.catalina.valves.AccessLogValve"directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log."suffix=".txt" /><Context docBase="ZhouDemo" path="" reloadable="true" source="org.eclipse.jst.jee.server:ZhouDemo" /></Host></Engine></Service>
</Server>
其中改变之后两个地方
<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443" />
原来默认是8080,后改为80
<Context docBase="ZhouDemo" path="" reloadable="true" source="org.eclipse.jst.jee.server:ZhouDemo" />
将path设置为空字符串。
就可将localhost:8080/TestDemo/index.jsp访问形式转成为
localhost/index.jsp
6、经过隧道访问地址
http://zwx.viphk.ngrok.org/
还可以使用买来的域名,替换设置。
最后域名为
http://chixi.online/
网站模板
http://pan.baidu.com/s/1eRZ1Hrc
设置初始页面
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>