Payara Server Basics Part 1 – Installing Apache on Ubuntu

Payara

In this blog series, we will aim to give an overview of the basics of using Payara Server in a production scenario using Apache Web Server (sometimes called httpd) and Ubuntu 16.04. Many of the concepts described in these blogs do not rely on the tools we are using here and can be applied to other scenarios.

Our aim is to configure the following:

 

apache blog 1.jpg

Here we have an Apache web server which will be exposed to our users. Their requests will be forwarded to one of two Payara Server instances and we will use sticky sessions based on the JSESSIONID cookie to make sure each user interacts with the same Payara Server. We will also investigate session replication and prove that, if one Payara Server goes down, the other will be able to handle the existing sessions seamlessly.

 

The first step in our scenario will be to install Apache web server on Ubuntu 16.04.

 

 

What is Apache Web Server?

Apache-Web-Server.pngApache Web Server, also known as just “Apache”, is simply a server which can handle web traffic and can be extended through the use of modules. Calling the web server Apache may seem a little confusing at first,  but generally when talking about a software product it refers to the Apache HTTP Server which is developed and maintained by the Apache Software Foundation (ASF). As an open-source community, the ASF maintains a very large range of software, but the web server was the first and it was the web server that lent its name to the foundation.

 

How can I install Apache Web Server?

At this point it is worth noting that the installation of Apache HTTP Server may differ by distribution. The package in Ubuntu’s repository has a set of helper tools – commands which make it easier to manage configuration files – and a different folder structure, aimed at making life easy when managing very large web sites.

For Ubuntu 16.04, Apache web server is available as a package in the aptitude repository and can be installed from a terminal as follows:

sudo apt install apache2

Note that, earlier versions of Ubuntu, you will need to use “apt-get” in place of simply “apt” in 16.04 and above.

 

This command will fetch the latest version of the package from the repository and install it as a service, meaning that you can use the service command to control it. Stopping, starting and restarting Apache is handled as follows:

sudo service apache2 stop
sudo service apache2 start
sudo service apache2 restart

When the installation has finished, the Apache service should automatically be started. If not, you should be able to use the commands above to start it yourself. Once that has been done, you can confirm it is running by visiting http://localhost in your browser:

 

apache blog 2.png

 

The Ubuntu Default Page above gives an overview and explanation of the folder structure and the helper tools such as a2enmod (enable a module) and a2dismod (disable a module).

 

Next steps

Now that Apache is installed, we can use it to forward requests to Payara Server. In our next blog, we will look at how to configure Apache to transparently forward requests to Payara Server.

 

 

 

{{cta(‘a591925d-60f3-4d12-9da6-6123459ccf71’)}}

 

Comments (2)

Post a comment

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

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

  1. Korbinian

    Nice idea to show this for a simple cluster – may I ask why you did chose apache2 over nginx? Is there any technical reason for this?

    1. Michael Ranaldo

      No reason in particular; Apache was the most popular server available and the one I was most familiar with.

      This implementation should be replicable on other servers, though maybe not word for word.

Related Posts

payara qube logo 5 minutes
Payara

Payara Cloud Is Now part of Payara Qube family of Unified Platforms for Enterprise Java

Payara Cloud is becoming part of Payara Qube family of Java application deployment runtimes. This move reflects how the […]

Payara promotional graphic showing transition from Spring to Jakarta EE, including technology logos, a code icon and arrows leading from Spring to Jakarta EE. 6 minutes
Jakarta EE

From Spring Boot To Jakarta EE 11: How Payara Starter Eases The Transition

If you’ve been living in the Spring ecosystem, you’re used to fast project setup. Spring Initializr gives you a […]

Promotional graphic for a podcast episode titled “Why Open Source is the Future of Business Innovation - A conversation with Arun Gupta”. The podcast is hosted by Payara Community. The right side features a photo of the speaker, Arun Gupta, labeled as a “VP, Developer Experience at JetBrains”. The design uses dark blue and teal backgrounds with coral and fish illustrations. 2 minutes
Community

Payara Podcast – Why Open Source is the Future of Business Innovation – A Conversation with Arun Gupta

Open source is no longer a developer-only concern — it’s at the heart of how modern businesses innovate, build […]