azureartifactory

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 /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/conf
    
  • Create and edit the /opt/bitnami/apps/myapp/conf/httpd-prefix.conf file and add the line below to it:

      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 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
      </Location>
    

    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 Tomcat virtual host files at /opt/bitnami/apache/conf/vhosts/tomcat-vhost.conf and /opt/bitnami/apache/conf/vhosts/tomcat-https-vhost.conf, right before the closing VirtualHost tag at the end of the file:

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

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

Last modification December 21, 2022