【问题标题】:How I can connect Apache server remotely (http://149.4.223.238:8080) through my local machine如何通过本地计算机远程连接 Apache 服务器(http://149.4.223.238:8080)
【发布时间】:2018-10-09 12:35:37
【问题描述】:

我将 Eclipse 与 Tomcat 8.0 一起使用,并成功运行 Web 应用程序并将其部署到 Apache 服务器中。 现在我的问题是如何访问在线 apache 主机地址应用程序管理器,以便在此主机上部署我的应用程序 Remove Server Address

tomcat_users.xml

<tomcat-users>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>   
<user username="tom" password="tom123" roles="admin-gui"/>
<user username="malik" password="malik123" roles="manager-gui,manager-script,manager-jmx,manager-status"/>

</<tomcat-users>

我将此添加到 server.xml

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" address="149.4.223.238" redirectPort="8443"/>

Context.xml

<Context antiResourceLocking="false" privileged="true" >
  <!--
    Remove the comment markers from around the Valve below to limit access to
    the manager application to clients connecting from localhost
  -->

  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="149\.4\.223\.238|127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />

 </Context>

我正在搜索过去 5-7 小时,但仍然不明白。

【问题讨论】:

    标签: java eclipse apache server host


    【解决方案1】:

    http://149.4.223.238:8080/manager/html

    您可能还没有配置它。该链接还告诉您如何设置它。此外,如果您远程连接该机器并通过 localhost:8080/manager/html 访问该站点,那也应该可以工作。

    更多详情

    https://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

    【讨论】:

    • 我通过 localhost:8080/manager/html 成功访问并部署了我的网络应用程序到应用程序管理器中,但我想将网络应用程序部署到在线主机地址中。
    • 好的,那么您只需阅读该站点并对其进行配置,以便您可以访问它。
    • 如果您需要帮助找出问题所在,您可能需要发布您的配置文件(那些 xml)。在发布之前取出敏感信息。
    【解决方案2】:

    您的 Valve 配置限制了对服务器自身 IP、公共 IP 和环回地址的访问

    <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="149\.4\.223\.238|127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
    

    因此,如果您想允许从您的公共 IP 进行访问(请注意,这是一个安全漏洞),您应该将其包含在正则表达式中。 作为一个选项,您可以通过 ssh 隧道访问它(也可以使用 putty 完成)

    ssh -L 8080:localhost:8080 some_user@149.4.223.238
    

    现在应该可以从 localhost:8080 访问它了。

    【讨论】:

    • 什么是ssh?我在 Windows 中使用 Eclipse。
    猜你喜欢
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多