我在 EC2 实例上安装了 Apache 来为我的网站提供服务。我从 GoDaddy 购买了该网站的域名。
为了在 AWS 托管的 EC2 实例上提供网站服务,我在 Route53 中为从 GoDaddy 购买的域创建了一个托管区域。
我更新了在 GoDaddy DNS 面板中的 Route53 中创建托管区域后获得的域名服务器。
名称服务器更新后,我在 Route53 的托管区域中创建了一条 A 记录,指向为服务我的网站而创建的 EC2 实例的公共 IP。
但是,我仍然无法通过域使用 Apache 访问 EC2 实例上提供的网站。
我于周一(2024 年 2 月 26 日)在 GoDaddy 面板中更新了域名服务器,自更新以来已经过去了近 2 天,但该网站仍然没有在目标域上提供服务。
这是我的 Apache 配置文件:
<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 www.example.com
ServerAdmin webmaster@localhost
ServerName test.instabook.app
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# 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
RewriteEngine on
RewriteCond %{SERVER_NAME} =test.instabook.app
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我无法理解为什么尽管执行了所有需要的任务,但网站仍然没有得到服务。