利用tomcat发布WEB项目到内网和外网的方法

来源:互联网 发布:迫击炮升级数据 编辑:程序博客网 时间:2024/05/19 17:52
利用tomcat发布WEB项目到内网和外网的方法 

我的计算机上的配置为:tomcat 7.0; Myeclipse 10.0;JDK 7.0; MS sql server 2008(未使用);

第(1)步:
     在oray网站上下载花生壳客户端网址为:http://www.oray.com/peanuthull/。
     并进行注册一个护照。
     注册后登录。然后申请一个免费的域名。网址为:https://console.oray.com/domain/free/
     申请成功后,要选中你申请的域名然后点击 激活花生壳 按钮。
     
第(2)步:
把\tomcat7.0\conf\server.xml文件中的:

     <Engine name="Catalina" defaultHost="jiaquan.vicp.cc">

      <!--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"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- 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"/>
      </Realm>

      <Host name="jiaquan.vicp.cc"  appBase="webapps"
            unpackWARs="true" >


修改为:

    
      <Engine name="Catalina" defaultHost="你的动态域名">

      <!--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"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- 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"/>
      </Realm>

      <Host name="你的动态域名"  appBase="webapps"
            unpackWARs="true" >


我的域名是 jiaquan.vicp.cc

所以我的这段代码如下:
     <Engine name="Catalina" defaultHost="jiaquan.vicp.cc">

      <!--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"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- 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"/>
      </Realm>

      <Host name="jiaquan.vicp.cc"  appBase="webapps"
            unpackWARs="true" >

第(3)步:
      把你电脑上的防火墙关闭。

第(4)步:
      在\tomcat7.0\conf\server.xml文件中找到
      <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
      把它修改为:
   <Connector port="8888" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
   也就是修改端口号。当然你可以修改为其它的号。
   
   现在我的网站的网址就是http://jiaquan.vicp.cc:8888/pro01/home.html(http://你的域名:端口号/你的网站目录)。
      把你的网址告诉你的朋友,让他们链接,就可以访问你自己计算机上的你自己做的网站了。
      如果我身过的朋友有问题,可以问一下我,我还是很乐意和你一起学习的。
      
我做的网站配置完成后的网址为:http://jiaquan.vicp.cc:8888/pro01/yy.jsp 
如果我的电脑正开着,你就可以通过上面的网址,打开我的网站。
0 0
原创粉丝点击