AWS ec2 instance with bitnami Lamp Apache Virtual host, domain and Wild card sub domain configuration

Problem :

I want to Point my domain “” to “xyz” folder/directory¬† and

any subdomain (* which will point to my “abc” folder/directory.

Solution :

Step : 1 To change the Apache configuration
Include the VHOST configuration file in httpd.conf so that Apache will check the Virtaul Host and Forward the
request according to it.
A) Open Apache configuration file in any editor we have used here nano editor

sudo nano /opt/bitnami/apache2/conf/httpd.conf

B) Include the vhosts conf file in httpd.conf

Include "/opt/bitnami/apache2/conf/extra/httpd-vhosts.conf"

Step : 2 To change the Apache configuration
Once you complete the apache configuration restart apache server, to restart server in bitnami lamp user below command:

sudo /opt/bitnami/ restart apache

Step : 3 Configure the Virtaul host
The term Virtual Host refers to the practice of running more than one web site (such as and on a single machine.

Open the vhosts configuration file in edit mode,please apply the following command

sudo nano /opt/bitnami/apache2/conf/extra/httpd-vhosts.conf

add the code in httpd-vhosts.conf :

# This is for the primary domain (
<VirtualHost *:80>
       DocumentRoot /home/bitnami/htdocs/VSMJan9

      <Directory /home/bitnami/htdocs/VSMJan9>
               Options Indexes FollowSymLinks
               AllowOverride All
               Require all granted

# This is for the subdomain (*
<VirtualHost *:80>
       VirtualDocumentRoot /home/bitnami/htdocs/VSM2
        ServerAlias *

        <Directory /home/bitnami/htdocs/VSM2>
                    Options +Indexes +FollowSymLinks +MultiViews +Includes
                    AllowOverride All
                    Require all granted

Step : 4 Restart Apache Server


sudo /opt/bitnami/ restart apache

Add a Comment

Your email address will not be published. Required fields are marked *