Create a custom Java application

Many users run a Bitnami stack as a development environment for their own projects (as opposed to running third-party applications). To create a custom Java application from scratch, follow the steps below. These steps assume that your application will live in the installdir/apps/myapp/ directory:

  • Run the following commands to create the directories:

      $ sudo mkdir installdir/apps/myapp
      $ sudo mkdir installdir/apps/myapp/conf
  • Create and edit the installdir/apps/myapp/conf/httpd-prefix.conf file and add the line below to it:

      Include "installdir/apps/myapp/conf/httpd-app.conf"
  • Create and edit the installdir/apps/myapp/conf/httpd-app.conf file and add the content below to it. This is the main configuration file for your application, so modify it further depending on your application’s requirements.

      <Location /myapp>
        ProxyPass ajp://localhost:8009/myapp
        ProxyPassReverse ajp://localhost:8009/myapp

    NOTE: 8009 is the default port for the AJP connector. If you have customized the stack to use a different port, change it here as well.

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

      Include "installdir/apps/myapp/conf/httpd-prefix.conf"
  • Restart the Apache Tomcat server.

You should now be able to access the application at http://localhost/myapp.

Last modification April 8, 2020