【问题标题】:Unable to launch host my site as https in AWS ec2 instance无法在 AWS ec2 实例中将我的站点作为 https 启动
【发布时间】:2016-10-26 05:35:03
【问题描述】:

我在 AWS EC2 上运行一个 ubuntu 实例。我正在尝试在 HTTPS 下配置我的默认 ec2 公共 DNS。我按照this blog 提供的步骤创建了所有必需的文件(.crt、.key 和 .csr)

我把 000-default.confg 文件改成如下

# 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 ec2-xxx-xxx-xxx-xxx.ap-southeast-1.compute.amazonaws.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html/abc

    # 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
    SSLEngine on
    SSLCertificateFile /ssl-certificates/testing.crt
    SSLCertificateKeyFile /ssl-certificates/testing.key
   SSLCertificateChainFile /ssl-certificates/testing.crt

即使在此之后,我也无法在 https 中打开我的网站

【问题讨论】:

    标签: ubuntu ssl https apache2 virtualhost


    【解决方案1】:

    如果您仍然获得 http 版本,请确保您正在侦听端口 443。如果您尚未编辑配置文件以侦听 443,只需将 <VirtualHost *:80 替换为 <VirtualHost *:443>。 另外我认为,由于您使用的是 aws,因此如果默认情况下尚未完成,则需要将 443 端口公开给互联网。

    【讨论】:

    • 我已配置为在 443 上收听。但我仍然面临同样的问题。以及如何将 443 端口暴露给互联网?我将代码 Listen 443 保留在 port.confg
    • 您可以从 AWS 控制面板打开您的 443 端口,我使用 AWS 已经有一段时间了,但我相信它们属于标记为安全组的东西,您需要单击安全组,然后添加一条规则以允许端口 443 上的流量。还有您遇到的任何错误吗?或者你只是重定向到http版本,即使你输入https://
    • 谢谢。更改 ec2 实例的安全组策略已修复它。这两天我一直在挠头。非常感谢。
    猜你喜欢
    • 1970-01-01
    • 2020-02-12
    • 2011-10-29
    • 2020-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-03
    • 1970-01-01
    相关资源
    最近更新 更多