Nux
Nux

Reputation: 7078

How to configure virtualhost for sub domain in Bitnami LAMP Stack?

I have managed to deploy my application on Google console using Bitnami LAMP. I am trying to set up subdomain but I keep getting this error.

This site can’t be reached subdomain.domain.com’s server IP address could not be found.

Here are my entries in httpd-vhosts.conf

    <VirtualHost *:80>
    ServerAdmin [email protected]
    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 [email protected]
    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 [email protected]
    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 [email protected]
    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.conf codes are

    # 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"

bitnami-apps-vhosts.conf codes are

# Bitnami applications installed in a Virtual Host
Include "/opt/bitnami/apache2/conf/extra/httpd-vhosts.conf"

domain.com works fine. Can someone help me to fix subdomain.domain.com

Upvotes: 0

Views: 2348

Answers (1)

neilH
neilH

Reputation: 3438

Have you added a DNS entry for your sub-domain address?

This would be necessary if you would like to direct traffic to a single IP address from both your main domain address and your sub-domain address.

The error message you are receiving may be the result of the sub-domain address not being associated with an IP address.

If you havn't added a DNS entry for the sub-domain address, there is some useful information here and here about adding a sub-domain to your DNS configuration.

Upvotes: 2

Related Questions