【问题标题】:Point domain and subdomain from Route53 to DigitialOcean using https使用 https 将域和子域从 Route53 指向 DigitialOcean
【发布时间】:2018-11-02 08:16:34
【问题描述】:

我有两个 wordpress 站点在两个 digitialocean 液滴上运行。 他们都有 ssl 证书并将所有请求重定向到 https。

让我们拨打第一个地址https://my-freenom-domain-1.ml

我们拨打第二个地址https://my-freenom-domain-2.ml

我在 route53 上注册了一个域。让我们将域称为 my-domain.com。

我正在尝试将所有请求从 https://my-domain.com 映射(而不是重定向)到 https://my-freenom-domain-1.ml 以及从https://subdomain.my-domain.comhttps://my-freenom-domain-2.ml 的所有请求

你会怎么做?

更新:

我试过的(没用)

  1. 创建一个简单的 CNAME。

主域 (my-domain.com) 的 CNAME:

无法为主域创建 CNAME 并给出以下错误: RRSet of type CNAME with DNS name my-domain.com. is not permitted at apex in zone my-domain.com.

子域的 CNAME (subdomain.my-domain.com):

我能够为子域创建 CNAME,但请求被重定向。 所以当我去 subdomain.my-domain.com 我被重定向到https://my-freenom-domain-2.ml

  1. 创建一个 S3“重定向桶”

我尝试创建一个 S3 存储桶来重定向子域的所有请求。 因此名为 subdomain.my-domain.com 的存储桶将所有重定向重定向到 https://my-freenom-domain-2.ml (https)。 然后,我为 subdomain.my-domain.com 创建了一个 CNAME,指向 subdomain.my-domain.com.s3-website-eu-west-1.amazonaws.com。 但是所有请求仍然被重定向...

【问题讨论】:

  • 在 route53 上添加 CNAME 记录?
  • 我试过了,但它以某种方式重定向了请求。我将使用我尝试过的不同解决方案(不起作用)更新问题

标签: dns digital-ocean amazon-route53


【解决方案1】:

您需要在 Digital Ocean 液滴上为您的新域创建一个虚拟主机,它才能正常工作。 所以我会做以下工作 -

  • 在 Droplets 的网络服务器上为新域创建虚拟主机, 或在 webserver 配置中添加新域作为服务器。

  • 将新域的 SSL 证书添加到旧网络服务器,或者在 ELB 处终止 ssl。

  • 为指向旧域服务器的新域添加 DNS CNAME 或 A 记录条目。

发布这个它应该可以工作。

【讨论】:

    【解决方案2】:

    这是基于@mdeora 的answer 正确答案以及一些细节。

    1.在 droplet 中为域 (my-domain.com) 创建一个虚拟主机

    复制默认配置:

    sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/my-domain.com.conf
    

    在 conf 中添加一个 ServerName:

    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
            ServerName my-domain.com
            DocumentRoot /var/www/html
    
            <Directory /var/www/html/>
                Options FollowSymLinks
                AllowOverride All
                Require all granted
            </Directory>
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    

    启用网站:a2ensite my-domain.com.conf

    重新加载 apache:systemctl reload apache2

    2。在 Droplets 服务器上安装 ssl 证书

    (我是使用 certbot 完成的)

    certbot --apache -d my-domain.com

    (遵循 certbot 说明)

    3.在 route53 中创建一条 A 记录

    创建一条A记录,并将其指向droplet的ip。

    (4. 更新 wordpress 设置)

    如果您运行的是 wordpress 网站,请务必将管理员中的 wordpress url 设置更改为 https://my-domain.com

    现在,希望一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-07
      • 2021-10-15
      • 2018-10-29
      • 2019-02-21
      • 2013-07-14
      • 2022-01-09
      • 2019-07-11
      • 1970-01-01
      相关资源
      最近更新 更多