This forum is no longer active. Please post your questions to our new community site

Forums LAMPStack

Troubleshooting DNS/Apache2 Virtual Host Issue

Subscribe to Troubleshooting DNS/Apache2 Virtual Host Issue 3 post(s), 2 voice(s)

 
Avatar TheRobBrennan 3 post(s)

Hi all! I’m having a quirky issue with DNS and Apache2 VirtualHost entries.

In my DNS record for my domain name, I have successfully set up aws.therobbrennan.com to point to my BitNami Amazon EC2 instance. I also have a wildcard entry so that any subdomain that does not have a DNS entry would automatically hit my BitNami instance.


In my “/opt/bitnami/apache2/conf/httpd.conf” I have the following:



Options FollowSymLinks
AllowOverride None
Order deny,allow
#Deny from all
Allow from all


Include conf/extra/httpd-vhosts.conf

Include “/opt/bitnami/apache2/conf/fastcgi.conf”
Include “/opt/bitnami/apps/phpmyadmin/conf/phpmyadmin.conf”
Include “/opt/bitnami/apps/wordpress/conf/wordpress.conf”

In my httpd-vhost.conf file, I simply have:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot “/opt/bitnami/apps/wordpress/htdocs”
ServerName blog.therobbrennan.com


If I leave my httpd-vhost.conf file as described above, a restart of apache server produces an unintended result. Instead of “blog.therobbrennan.com” resolving to my Wordpress installation, it totally fails. However, if I try a subdomain that has a DNS entry – aws – it resolves to the Wordpress site and not my default BitNami server root directory.

If I comment out those changes to the httpd-vhosts.conf file, aws.therobbrennan.com works, as does any other subdomain that doesn’t have a DNS entry such as horses.therobbrennan.com. Oddly enough, though, blog.therobbrennan.com still fails. It doesn’t even bring me to the BitNami server root – it just totally fails.

Any idea what I’m missing here?

 
Avatar TheRobBrennan 3 post(s)

Wahoo! I figured out my issue =) For those curious, here is what I had to do to solve it. Please note that this assumes you have properly configured your DNS record to allow a wildcard subdomain to point to your BitNami LAMPStack instance.

In my httpd-vhosts.conf file, I have:

NameVirtualHost *:80

  1. Virtual Hosts
    <VirtualHost *:80>
    DocumentRoot “/opt/bitnami/apache2/htdocs/”
    ServerName www.therobbrennan.com
    ServerAlias aws.therobbrennan.com

    <VirtualHost *:80>
    DocumentRoot “/opt/bitnami/apps/wordpress/htdocs”
    ServerAlias blog.therobbrennan.com
 
Avatar Beltrán Rueda Administrator 3,714 post(s)

I’m glad to hear that. Thanks for posting the solution.

Forums LAMPStack