azuremean

Create a custom HTTP-only application

NOTE: If you are running a Bitnami MEAN stack version prior to 4.2.5-1 check the specific section, since major changes were introduced in that version.

This example shows how to create a custom HTTP-only application, such as an AngularJS application that only requires an HTML index page and a CSS file and a Javascript file. Follow the instructions below:

NOTE: These steps assume that your application will live in the ~/projects/myapp/ directory:

  • Run the following commands to create the directory:

      $ mkdir -p ~/projects/myapp
    
  • Create and edit the /opt/bitnami/apache/conf/vhosts/myapp-http-vhost.conf file and add the following lines:

      <VirtualHost _default_:80>
        ServerAlias *
        DocumentRoot "/home/USER/projects/myapp"
        <Directory "/home/USER/projects/myapp">
          Require all granted
        </Directory>
      </VirtualHost>
    

    NOTE: Replace the USER placeholder with the system username, i.e. bitnami.

  • Create and edit the /opt/bitnami/apache/conf/vhosts/myapp-https-vhost.conf file and add the following lines:

      <VirtualHost _default_:80>
        ServerAlias *
        SSLEngine on
        SSLCertificateFile "/opt/bitnami/apache/conf/bitnami/certs/server.crt"
        SSLCertificateKeyFile "/opt/bitnami/apache/conf/bitnami/certs/server.key"
        DocumentRoot "/home/USER/projects/myapp"
        <Directory "/home/USER/projects/myapp">
          Require all granted
        </Directory>
      </VirtualHost>
    

    NOTE: Replace the USER placeholder with the system username, i.e. bitnami.

  • Restart the Apache server:

      $ sudo /opt/bitnami/ctlscript.sh restart apache
    

MEAN stack versions prior to 4.2.5-1

To create a custom HTTP-only application, such as an AngularJS application that only requires an HTML index page, a CSS file and a Javascript file, follow the steps below. These steps assume that your application will live in the /opt/bitnami/apps/myapp/ directory:

  • Run the following commands to create the directories:

      $ sudo mkdir /opt/bitnami/apps/myapp
      $ sudo mkdir /opt/bitnami/apps/myapp/htdocs/
      $ sudo mkdir /opt/bitnami/apps/myapp/conf
    
  • Create and edit the /opt/bitnami/apps/myapp/conf/httpd-prefix.conf file and add the following lines:

      Alias /myapp/ "/opt/bitnami/apps/myapp/htdocs/"
      Alias /myapp "/opt/bitnami/apps/myapp/htdocs/"
      Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
    
  • Create and edit the /opt/bitnami/apps/myapp/conf/httpd-app.conf file and add the following lines:

    IMPORTANT: This is the main configuration file for your application, so modify it further depending on your application’s requirements.

      <Directory /opt/bitnami/apps/myapp/htdocs/>
          Options +FollowSymLinks
          AllowOverride None
          Require all granted
      </Directory>
    

    NOTE: Bitnami uses the htaccess.conf file for security and performance purposes. This is the approach we recommend for custom applications too. However, if your application uses .htaccess files instead, you should change the AllowOverride None option to AllowOverride All and add an Include directive to include your custom .htaccess file after the above configuration block.

  • Once you have created the files and directories above, add the following line to the end of the main Apache configuration file at /opt/bitnami/apache/conf/bitnami/bitnami-apps-prefix.conf, as shown below:

      Include "/opt/bitnami/apps/myapp/conf/httpd-prefix.conf"
    
  • Restart the Apache server:

      $ sudo /opt/bitnami/ctlscript.sh restart apache
    

    You should now be able to access the application at http://SERVER-IP/myapp.

Last modification December 21, 2022