如何在Bitnami LAMP堆栈中为子域配置虚拟主机?

时间:2018-01-31 01:47:43

标签: apache google-compute-engine virtualhost bitnami google-cloud-launcher

我已设法使用Bitnami LAMP在Google控制台上部署我的应用程序。我正在尝试设置子域,但我一直收到此错误。

无法访问此网站 找不到subdomain.domain.com的服务器IP地址。

以下是我在httpd-vhosts.conf中的条目

[routerLink]="['artists', 'artistId']"

bitnami.conf 代码

    <VirtualHost *:80>
    ServerAdmin webmaster@DOMAIN.com
    DocumentRoot "/opt/bitnami/apache2/htdocs/DOMAIN_FILES"
    ServerName DOMAIN.com
    ServerAlias www.DOMAIN.com
    ErrorLog "logs/DOMAIN.com.com-error_log"
    CustomLog "logs/DOMAIN.com-access_log" common
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin webmaster@DOMAIN.com
    DocumentRoot "/opt/bitnami/apache2/htdocs/DOMAIN_FILES"
    ServerName DOMAIN.com
    ServerAlias www.DOMAIN.com
    ErrorLog "logs/DOMAIN.com.com-error_log"
    CustomLog "logs/DOMAIN.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@DOMAIN.com
    DocumentRoot "/opt/bitnami/apache2/htdocs/SUBDOMAIN_FILES"
    ServerName subdomain.DOMAIN.com
    ServerAlias www.subdomain.DOMAIN.com
    ErrorLog "logs/subdomain.DOMAIN.com.com-error_log"
    CustomLog "logs/subdomain.DOMAIN.com-access_log" common
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin webmaster@DOMAIN.com
    DocumentRoot "/opt/bitnami/apache2/htdocs/SUBDOMAIN_FILES"
    ServerName subdomain.DOMAIN.com
    ServerAlias www.subdomain.DOMAIN.com
    ErrorLog "logs/subdomain.DOMAIN.com.com-error_log"
    CustomLog "logs/subdomain.DOMAIN.com-access_log" common
</VirtualHost>

bitnami-apps-vhosts.conf 代码

    # Default Virtual Host configuration.

<IfVersion < 2.3 >
  NameVirtualHost *:80
  NameVirtualHost *:443
</IfVersion>

<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny                          
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

# Default SSL Virtual Host configuration.

<IfModule !ssl_module>
  LoadModule ssl_module modules/mod_ssl.so
</IfModule>

Listen 443
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+........"
SSLPassPhraseDialog  builtin
SSLSessionCache "shmcb:/opt/bitnami/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

<VirtualHost _default_:443>
  DocumentRoot "/opt/bitnami/apache2/htdocs"
  SSLEngine on
SSLCertificateFile "/opt/bitnami/apache2/conf/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apache2/conf/server.key"

  <Directory "/opt/bitnami/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny                          
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>


# Bitnami applications that uses virtual host configuration
Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf"

domain.com运行正常。有人可以帮我修复subdomain.domain.com

1 个答案:

答案 0 :(得分:2)

您是否为子域地址添加了DNS条目?

如果您想从主域地址和子域地址将流量引导到单个IP地址,则必须使用此功能。

您收到的错误消息可能是子域地址未与IP地址关联的结果。

如果您没有为子域地址添加DNS条目,则有关于向DNS配置添加子域的一些有用信息herehere