Docker针对Apache和Liferay重定向问题撰写

问题描述

目前,Liferay和Apache服务器已手动部署在服务器上。

我正在尝试使用现有配置在另一台服务器上使用Docker Compose启动httpd:2.4.39-alpine和liferay / dxp:7.1.10-security-dxp-17-202003-3-202006050913。

这些是我的配置:

  1. docker-compose.yml
version: "3.8"
services:
  mydxp:
    build:
      context: build/docker
    networks:
      - test-network
    image: liferay/dxp:7.1.10-security-dxp-17-202003-3-202006050913
    expose:
      - "8282"
    ports:
      - "8282:8080"
  myapache:
    build:
      context: docker-ref/apache
    networks:
      - test-network
    image: httpd:2.4.39-alpine
    expose:
      - "8181"
    ports:
      - "8181:33090"
    volumes:
      - "./docker-ref/apache/htdocs:/usr/local/apache2/htdocs"
      - "./docker-ref/apache/conf:/usr/local/apache2/conf"
networks:
  test-network:
  1. docker-ref / apache / conf / httpd.conf
Listen 33090
  1. docker-ref / apache / conf / extra / httpd-vhosts-local.conf
<VirtualHost *:33090>
    ServerName mydxp

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^127.0.0.1:8282$  [OR]
    RewriteCond %{HTTP_HOST} ^127.0.0.1:8282$
    # CUSTOM RewriteCond %{HTTPS} off
    RewriteRule ^/(?)$ http://%{HTTP_HOST}/web/developer/home

    # CUSTOM RequestHeader set X-Forwarded-Proto "https"
    ProxyPreserveHost On

    # Configuration for proxy page
    ProxyPass /css !
    ProxyPass /fonts/Open_Sans !
    ProxyPass /fonts/FontAwesome !
    ProxyPass /error_pages !
    ProxyPass /img !

    ProxyPass /disable http://%{HTTP_HOST}/error_pages/disable.html

    ErrorDocument 502 /error_pages/502.html

    ProxyPass / http://127.0.0.1:8282/
    ProxyPassReverse / http://127.0.0.1:8282/

    LimitRequestFieldSize 500000
    LimitRequestLine 500000
</VirtualHost>

当这些容器启动时,使用http:// localhost:8282 /返回Liferay的主页,但是当我单击http:// localhost:8181 /时,我得到“ 503服务不可用”

有没有一种方法可以检查/调试Apache在什么时候放弃/拒绝请求? 谢谢

解决方法

问题与流量重定向到的位置有关。代替

127.0.0.1:8282

我用过

<container_name>:8080

并且流量已正确重定向。