【问题标题】:how to redirect different domains to their respective application ports如何将不同的域重定向到各自的应用程序端口
【发布时间】:2018-07-01 11:04:25
【问题描述】:

我有 VPS,目前我在该服务器上运行 5 个 Spring Boot 应用程序以及 httpd。 这些应用程序的所有 html 都在它们各自的 jar 中。他们都有不同的域名。因此,在点击 dns 名称后,它应该会自动转到该端口应用程序,现在我需要明确指定端口号,例如 example.com:9090 我在 httpd.conf 中尝试了虚拟主机,但它不起作用。

Listen 9001

<VirtualHost *:9001>
    ServerAdmin admin@admin.askcomputers.co.in
    DocumentRoot /var/www/html/example2.com
    ServerName www.example2.com
</VirtualHost>

【问题讨论】:

    标签: apache spring-boot virtualhost httpd.conf


    【解决方案1】:

    我认为您应该确保为 httpd 安装了正确的模块:

    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    

    那么我认为您应该有 5 个带有反向代理设置的 VirtualHost 部分:

    <VirtualHost www.example1.com:80>
        ServerAdmin admin@admin.askcomputers.co.in
        ServerName www.example1.com
        ProxyRequests Off
        ProxyPass / http://localhost:9090
        ProxyPassReverse / http://localhost:9090
    </VirtualHost>
    ...
    <VirtualHost www.example5.com:80>
        ServerAdmin admin@admin.askcomputers.co.in
        ServerName www.example5.com
        ProxyRequests Off
        ProxyPass / http://localhost:9094
        ProxyPassReverse / http://localhost:9094
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-15
      • 2020-01-20
      • 2013-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-03
      相关资源
      最近更新 更多