【问题标题】:Point subdomain to EC2 instance through https通过 https 将子域指向 EC2 实例
【发布时间】:2017-04-07 19:06:44
【问题描述】:

通过实施以下步骤,我已成功将托管在我的主机提供商 (1and1) 上的子域重定向到 AWS 上的 EC2 实例:

  • 在我的 EC2 实例上创建弹性 IP
  • 将弹性 IP 地址添加到我的子域的 DNS 设置中

问题:我现在如何允许 https 请求?子域有一个有效的 SSl 证书,但是当我调用 https://mysubdomain.example.com 时,我收到以下错误:

无法访问此站点,mysubdomain.example.com 拒绝连接。

我的 EC2 实例上的安全组设置允许使用 https,尽管似乎在键入时端口 443 未正确打开:

sudo netstat -tlnp

返回:

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      10144/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      3081/master
tcp6       0      0 :::80                   :::*                    LISTEN      16084/httpd
tcp6       0      0 :::22                   :::*                    LISTEN      10144/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      3081/master

有什么想法吗? EC2 实例在 Apache VirtualHost 上运行。非常感谢。

我在 Apache 上运行,.conf 看起来像这样:

<VirtualHost *:80>

    Servername xx.xx.xx.xx

    WSGIPassAuthorization On
    WSGIDaemonProcess bottle_app threads=5 python-path=/var/www/bottle_app/:/usr/lib/python2.7/site-    packages/:/usr/lib64/python2.7/site-packages/

    WSGIScriptAlias / /var/www/bottle_app/app.wsgi

    <Directory /var/www/bottle_app>
        WSGIProcessGroup bottle_app
        WSGIApplicationGroup %{GLOBAL}
        WSGIScriptReloading On
        Order deny,allow
        Allow from all
        # Require all granted
    </Directory>

    ErrorLog /var/log/httpd/errors.log
    CustomLog /var/log/httpd/requests.log combined

</VirtualHost>

【问题讨论】:

  • 您运行的是哪个操作系统?是否有防火墙阻止了 443 端口?您可以发布您的 Apache 配置吗?
  • Oswin,刚刚添加了有关 Apache conf 的请求信息
  • 我在下面添加了一个答案。希望对您有所帮助。

标签: ssl amazon-ec2


【解决方案1】:

您的 Apache 虚拟主机配置表明您仅在端口 80 上提供服务,并且没有设置 tls。您需要生成或获取证书并在 Apache 中设置 https 访问。请阅读以下文章。如果您使用自行生成的证书,浏览器将不会信任它。

How to set up https in Apache

How to get a free trusted certificate with let's encrypt

【讨论】:

    猜你喜欢
    • 2019-03-19
    • 2017-12-10
    • 2021-01-29
    • 1970-01-01
    • 2021-05-10
    • 2015-12-17
    • 2020-06-18
    • 1970-01-01
    • 2014-01-02
    相关资源
    最近更新 更多