Amazon web services AWS上的每个子域是否可以有单独的cname记录

Amazon web services AWS上的每个子域是否可以有单独的cname记录,amazon-web-services,amazon-elastic-beanstalk,amazon-route53,Amazon Web Services,Amazon Elastic Beanstalk,Amazon Route53,我想要www.example.com、staging.example.com和demo.example.com,其中每一个都映射到弹性豆茎上相同应用程序的单独环境 这可能吗 在我的example.com.托管区域中,我为www.example.com、staging.example.com和demo.example.com设置了cname记录,每个记录都有一个指向各自的EB url的值 我设置的第一个www.example.com工作,请求到达环境。但是,当我尝试使用ping staging.e

我想要
www.example.com
staging.example.com
demo.example.com
,其中每一个都映射到弹性豆茎上相同应用程序的单独环境

这可能吗

在我的
example.com.
托管区域中,我为
www.example.com
staging.example.com
demo.example.com
设置了cname记录,每个记录都有一个指向各自的EB url的值

我设置的第一个
www.example.com
工作,请求到达环境。但是,当我尝试使用
ping staging.example.com
联系其他人时,结果是
ping:cannotresolve staging.example.com:Unknown host

  • 购买的域名和托管在53号公路上的区域
  • AWS证书管理器上颁发的证书
  • 我在每个负载平衡器上设置了相同的证书
  • 第一个,
    www.example.com
  • 其他人没有
  • 我不确定我错过了什么,除非这是不可能的
这有可能开始工作吗

注意:我已将实际域替换为
example.com

更新1: 我可能正在靠近,但它还没有工作,它正在返回
您没有权限访问/user

通过此链接

我补充说:

files:
  "/etc/httpd/conf.d/vhost.conf":
    mode: "000644"
    owner: root
    group: root
    encoding: plain
    content: |
      NameVirtualHost *:80

      <VirtualHost *:80>
        DocumentRoot "/var/app/current/"
         <Directory "/var/app/current/">
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Require all granted
         </Directory>
      </VirtualHost>

      <VirtualHost *:80>
       ServerName staging.example.com
       DocumentRoot "/var/app/current/your-new-webroot"
        <Directory "/var/app/current/your-new-webroot">
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Require all granted
        </Directory>
      </VirtualHost>
答复是:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /user
on this server.<br />
</p>
</body></html>
此外,根据我的
/var/log/httpd/error\u log
日志:

AH01630: client denied by server configuration: /var/app
更新3: 几点

  • 更新了
    目录
    文档根
    以指向我的flask应用服务器上实际存储我的应用程序文件的位置,
    “/opt/python/current/app”
    ,之前我复制并粘贴了
    “/var/app/current/”

  • 使用
    httpd-v
    检查了我的apache版本。结果是,
    服务器版本:Apache/2.4.27(Amazon)\n服务器构建时间:2017年9月24日23:19:50

  • 更新文件:

    files:
      "/etc/httpd/conf.d/vhost.conf":
        mode: "000644"
        owner: root
        group: root
        encoding: plain
        content: |
          NameVirtualHost *:80
    
          <VirtualHost *:80>
           ServerName staging.example.com
           DocumentRoot "/opt/python/current/app"
            <Directory "/opt/python/current/app">
             Options Indexes FollowSymLinks MultiViews
             AllowOverride All
             Require all granted
            </Directory>
          </VirtualHost>
    
          <VirtualHost *:80>
            ServerName www.example.com
            DocumentRoot "/opt/python/current/app"
             <Directory "/opt/python/current/app">
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Require all granted
             </Directory>
          </VirtualHost>
    
    文件:
    “/etc/httpd/conf.d/vhost.conf”:
    模式:“000644”
    所有者:root
    组:根
    编码:普通
    内容:|
    名称虚拟主机*:80
    ServerName staging.example.com
    DocumentRoot“/opt/python/current/app”
    选项索引跟随符号链接多视图
    允许超越所有
    要求所有授权
    服务器名www.example.com
    DocumentRoot“/opt/python/current/app”
    选项索引跟随符号链接多视图
    允许超越所有
    要求所有授权
    

    仍然得到相同的结果。

    ping staging.example.com之所以有效,是因为您的CNAME解析正确。但是,
    VirtualHost
    指令是以线性方式应用的。由于您的第一个
    VHost
    节不包含
    ServerName
    ,因此默认情况下它将应用于所有请求

    更改两个
    VHost
    部分的顺序,或者向它们添加一个
    ServerName
    ,事情就应该开始工作了(可能需要重新启动EB应用程序)


    如果403错误还有其他原因,您也可以检查机器本身的日志文件。

    DNS更改可能需要时间传播。您应该使用
    nslookup
    并使用AWS提供的DNS服务器或对其进行配置。您可以阅读:我已经更新了每篇文章。>如果403错误还有其他原因,您还可以检查机器本身的日志文件@tim_xyzI发布了这些日志,
    /var/log/httpd/error_log
    。还有其他我应该看的吗?抱歉,我不太熟悉基础设施配置。好吧,可能是apache版本不匹配@tim_xyz能否确认您是否确实在使用Apache2.4或更高版本?如果没有,检查这个我已经检查了apache版本。它的
    Apache/2.4.27
    。将我的vhost文件更新到适当的
    目录“/opt/python/current/app”
    ,并审阅了这篇文章。还有什么我想试试的吗?
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>403 Forbidden</title>
    </head><body>
    <h1>Forbidden</h1>
    <p>You don't have permission to access /user
    on this server.<br />
    </p>
    </body></html>
    
    AH01630: client denied by server configuration: /var/app
    
    files:
      "/etc/httpd/conf.d/vhost.conf":
        mode: "000644"
        owner: root
        group: root
        encoding: plain
        content: |
          NameVirtualHost *:80
    
          <VirtualHost *:80>
           ServerName staging.example.com
           DocumentRoot "/opt/python/current/app"
            <Directory "/opt/python/current/app">
             Options Indexes FollowSymLinks MultiViews
             AllowOverride All
             Require all granted
            </Directory>
          </VirtualHost>
    
          <VirtualHost *:80>
            ServerName www.example.com
            DocumentRoot "/opt/python/current/app"
             <Directory "/opt/python/current/app">
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Require all granted
             </Directory>
          </VirtualHost>