Apache2 - .app 虚拟主机错误

Apache2 - .app 虚拟主机错误

我正在尝试举办xyz.appApache 上的 URL。我已经在服务器上配置了所有内容,但我甚至没有在 access.log 上收到任何内容。在同一台服务器上,我已经托管了 .com 网站,该网站运行良好。以下是我使用的环境;

操作系统:Ubuntu 20.04.2 LTS

服务器:Apache/2.4.41

我的xyz配置文件文件如下;

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName xyz.app

        <Directory "/var/www/xyzapp">
                AllowOverride All
                Require all granted
        </Directory>
        # ServerAdmin webmaster@localhost
        DocumentRoot /var/www/xyzapp

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

我的apachectl -S输出如下;

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server xyz.app (/etc/apache2/sites-enabled/xyz.conf:1)
         port 80 namevhost xyz.app (/etc/apache2/sites-enabled/xyz.conf:1)
         port 80 namevhost aaa.com (/etc/apache2/sites-enabled/aaa.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex proxy: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used

我尝试过从其他机器进行跟踪路由,并且成功跟踪到服务器,因此我的 DNS 配置没有问题。此外,我直接使用 HTTP://IP 进行了检查,它带我进入了登录页面。但我的 xyz.app URL 不起作用。任何帮助都将不胜感激。谢谢

答案1

浪费了几天时间后,我终于搞清楚了这个问题。在这里发布,以便将来对任何人有所帮助。我验证了我的网络调用,它显示每当我尝试调用 HTTP 时,它都会将我重定向到 HTTPS(即使我编辑了 URL 并再次尝试)。为了检查它,我偶然发现了这个帖子在 GoDaddy 论坛上,有以下信息

这是因为它们带有免费的 SSL(根据域名注册),因此浏览器需要使用 HTTPS。

因此,我使用 SSL 证书升级了我的 HTTP 托管,一切运行顺利。显然,没有任何配置问题,问题与 URL 和 .app 域有关。

相关内容