How to create virtual hosts in a Bitnami AMI hosting server?

| | 1 min read

Many Drupal users using Bitnami wanted to know how to create virtual hosts in a Bitnami AMI hosting server. If you are facing the same question with Bitnami for your Drupal site then read on to find out the solution.

Bitnami is an open source software project that produces installers for web applications. Bitnami also produces solutions stacks and virtual appliances. Follows the steps below to configure Bitnami to create virtual hosts

  • First we need to configure Apache to create Virtual hosts
  • This is done by adding the Bitnami configuration file to the main Apache settings file located at
    /opt/bitnami/apache2/conf/httpd.conf
  • We need to include the following config file in the main Apache settings file using the directive below
    Include "/opt/bitnami/apps/virtualhost.conf"
  • This file will be used as the new Apache virtual hosts configuration file for all of our applications.
  • We need to create this file and make it writable for the bitnami user
    sudo touch /opt/bitnami/apps/virtualhost.conf
    sudo chown bitnami /opt/bitnami/apps/virtualhost.conf
  • Next we need to include application-specifi configuration directives in the virtualhost.conf file as follows
    NameVirtualHost *:80
    
    your site configuration ###
    
    ServerAdmin [email protected]
    DocumentRoot "/opt/bitnami/apps/{your_site_files_folder}" 
    ServerName {your_site_name}
    ServerAlias www.{your_site_name}
    ErrorLog "logs/{your_site_name}-error_log" 
    CustomLog "logs/{your_site_name}-access_log" common
    
    
    Options Indexes MultiViews +FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    
  • Finally restart the Apache Web Server for the changes to take effect.
    sudo /opt/bitnami/ctlscript.sh restart apache