2014-01-14 3 views
0

로컬 Tomcat 7.50 서버에서 웹 응용 프로그램을 실행하고 있습니다. 운영 체제는 Mac OS Mavericks입니다. 로컬 IP 주소 (예 : 192.168.2.153:8089)를 사용하면 동일한 집에있는 모든 컴퓨터에서 웹 응용 프로그램에 쉽게 액세스 할 수 있습니다. 문제는 Tomcat 7.50 서버를 실행하는 시스템의 공용 IP를 사용하여 웹 응용 프로그램에 액세스 할 수 없다는 것입니다. 당신은 (서버 호스팅) 경로를 통해 포트 포워딩로 알려진 뭔가를 설정해야공용 IP 주소를 사용하여 실행중인 Tomcat 7.50에 연결할 수 없습니다.

<?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"> 
    <!-- Security listener. Documentation at /docs/config/listeners.html 
    <Listener className="org.apache.catalina.security.SecurityListener" /> 
    --> 
    <!--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" /> 
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> 
    <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> 

    <!-- 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="8089" protocol="HTTP/1.1" 
       connectionTimeout="20000" 
       redirectPort="8443" 
       useIPVHosts="true" /> 
    <!-- A "Connector" using the shared thread pool--> 
    <!-- 
    <Connector executor="tomcatThreadPool" 
       port="8089" protocol="HTTP/1.1" 
       connectionTimeout="20000" 
       redirectPort="8443" 
       useIPVHosts="true" /> 
    --> 
    <!-- 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="localhost"> 

     <!--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="localhost" appBase="webapps" 
      unpackWARs="true" autoDeploy="true"> 

     <!-- SingleSignOn valve, share authentication between web applications 
      Documentation at: /docs/config/valve.html --> 
     <!-- 
     <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> 
     --> 

     <!-- Access log processes all example. 
      Documentation at: /docs/config/valve.html 
      Note: The pattern used is equivalent to using pattern="common" --> 
     <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 
       prefix="localhost_access_log." suffix=".txt" 
       pattern="%h %l %u %t &quot;%r&quot; %s %b" /> 

     </Host> 
    </Engine> 
    </Service> 
</Server> 
+0

tomcat 서버를 실행하는 컴퓨터가 인터넷에 직접 연결되어 있습니까? 아니면 외부 IP 주소와 내부 192.168 네트워크를 가진 라우터를 가지고 있습니까? 그렇다면 라우터에서 포트를 앞으로 구성해야합니다. –

+0

나는 내 자매 집에있는 손님이며 물론 라우터를 사용하고 있습니다.이 URL (http://www.yougetsignal.com/tools/open-ports/)을 사용하여 포트 8089를 컴퓨터의 IP 주소와 함께 확인했습니다. 항구가 열려 있다고 말합니다. – skiabox

+3

포트가 열려 있으면 충분하지 않습니다. NAT 라우터는 해당 포트를 특정 시스템으로 전달하도록 구성되어야합니다. 이것은 Tomcat 구성과는 아무런 관련이 없습니다. – Dmitri

답변

1

: 봐 여기 : http://www.wikihow.com/Set-Up-Port-Forwarding-on-a-Router

다음

는 Tomcat 서버의 server.xml 파일입니다

인터넷을 통해 컴퓨터에 액세스 할 수있게 만들 예정이므로주의하십시오.

대부분의 경우 집 IP 주소는 동적이므로 (수시로 변경됨) 올바른 IP를 사용하여 서버에 액세스하고 있는지 확인하십시오. http://www.noip.com/ 관리자 IP 주소를 확인하십시오.

0

공개 IP (예 : 119.56.1.78)를 할당해야하며 해당 IP를 가진 트래픽을 시스템에 라우팅하도록 ISP에 확신시켜야합니다. 첫번째 부분은 사소한 것입니다 ... ip addr를 사용하여 119.56.1.78 dev eth0 을 입력하여 해당 IP를 systemm에 추가하고 ip addr del 119.56.1.78 dev eth0 을 사용하여 제거하십시오. 올바른 IP 및 인터페이스를 선택하십시오 (eth0이 아닐 수도 있습니다).

두 번째 부분은 쉽지 않으므로 IP 할당이 나올 때까지 첫 부분을 시도하십시오. 홈 라우터가 있습니까? 아니면 ISP 모뎀에 내장되어 있습니까? 그렇다면 해당 IP를 할당 할 수 있습니다. 라우터를 제거하고 서버를 WAN에 노출시킬 수도 있지만 고려해야 할 보안 문제가 있습니다.

포트 9090을 로컬 시스템 (192.168.1.1)으로 전달하고 아 시초 IP를 전혀 추가하지 않도록 로컬 라우터를 구성 할 수 있습니다. 그러나 더 많은 정보없이 아무도 어떻게 추측 할 수 없습니다.

관련 문제