Apache Bitnami 虚拟主机无法正确路由子域

问题描述 投票:0回答:1

我有一个 lightsailt LAMP 实例。它使用 bitnami,我更改了 /opt/bitnami/apache/conf/httpd-vhosts.conf 以添加新的子域。

<VirtualHost *:80>
    ServerName newsubdomain.domain.com
    ServerAlias newsubdomain.domain.com
    DocumentRoot /home/bitnami/test
        <Directory /home/bitnami/test/>
                Options -Indexes
                AllowOverride All
                Require all granted
        </Directory>
    ErrorLog "logs/test-error_log"
    CustomLog "logs/test-access_log" common
</VirtualHost>
<VirtualHost *:80>
    ServerName oldsubdomain.domain.com
    ServerAlias oldsubdomain.domain.com
    DocumentRoot "/opt/bitnami/apache/htdocs"
        <Directory /opt/bitnami/apache/htdocs>
                Options -Indexes
                AllowOverride All
                Require all granted
        </Directory>
    ErrorLog "logs/old.com-error_log"
    CustomLog "logs/old.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
    ServerName SERVER IP
    ServerAlias SERVER IP
    DocumentRoot /home/bitnami/test
        <Directory /home/bitnami/test/>
                Options -Indexes
                AllowOverride All
                Require all granted
        </Directory>
    ErrorLog "logs/ip-error_log"
    CustomLog "logs/ip-access_log" common
</VirtualHost>

我还在 /opt/bitnami/apache/conf/vhosts/ 名称 test-vhost.conf 中添加了一个新文件:

  <VirtualHost 127.0.0.1:80 _default_:80>
    ServerAlias newsubdomain.domain.com
    DocumentRoot /home/bitnami/test
    <Directory "/home/bitnami/test">
      Options -Indexes +FollowSymLinks -MultiViews
      AllowOverride All
      Require all granted
    </Directory>
  </VirtualHost>

当我转到服务器 ip 时,我得到测试 index.html,但是当我转到新子域时,我会被重定向到旧子域页面。

我使用bitnami脚本重新启动了apache,完全重新启动了bitnami守护进程,但是进入新的子域时我无法获取测试页面,我只能重定向到旧的子域页面。

apache bitnami vhosts
1个回答
0
投票

Let's Encrypt 正在将 HTTPS 请求重新路由到 oldsubdomain。如果我专门访问 http://newsubdomain.domain.com 我会得到测试文件。

© www.soinside.com 2019 - 2024. All rights reserved.