【问题标题】:How can I directly access my web application deployed in AWS tomcat using domain address?如何使用域地址直接访问部署在 AWS Tomcat 中的 Web 应用程序?
【发布时间】:2018-05-29 06:36:39
【问题描述】:

我已经在 AWS tomcat 服务器中部署了我的 Angular2 Web 应用程序,该服务器在 8080 端口上运行。我的 Spring Boot 后端应用程序部署在同一个 tomcat 服务器中。

已将我的公共地址映射到我在 Godaddy 中的注册域。

现在我可以通过 http://example.com:8080/my_client

访问我的应用程序 appln

我想通过 http://example.com 直接访问它。 dnt 想在 url 中看到 8080 端口和 appln 名称。

已经尝试使用 apache 代理配置。但是无法获得预期的结果。

【问题讨论】:

  • 运行这个 iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

标签: apache amazon-web-services tomcat amazon-ec2


【解决方案1】:

有两种选择

1) 将 tomcat 端口从 8080 更改为 80(不推荐)。

nano tomcat_dir/conf/server.xml

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

2) 使用 apache 虚拟主机配置。

<VirtualHost *:80> 
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName example.com
  ProxyPass http://example.com http://localhost:8080/example
  ProxyPassReverse http://example.com http://localhost:8080/example
</VirtualHost> 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-02
    • 1970-01-01
    • 2016-03-30
    • 2012-03-17
    • 2015-05-20
    • 2011-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多