How To Install the Apache Web Server on Ubuntu 16.04

in how-to •  7 years ago 

The Apache HTTP server is one of the most widely-used web server currently in the world. Apache provides many powerful features including dynamically loadable modules, robust media support, and extensive integration with other popular software.

So In this guide, we'll discuss how to install an Apache web server on your Ubuntu 16.04 server.

Step 1: Login to the server
Screen Shot 2018-02-22 at 6.34.25 PM.png
Open your SSH client / Terminal Window - Windows, MacOS, Linux
Type:

ssh [email protected]

OR (IP address version)
Screen Shot 2018-02-22 at 6.36.33 PM.png
ssh [email protected]
If this is your first time connecting to the server from this computer, you will see the following output. Accept the connection by typing "yes."

The authenticity of host 'example.com (123.123.123.123)' can't be established.
RSA key fingerprint is 3c:6d:5c:99:5d:b5:c6:25:5a:d3:78:8e:d2:f5:7a:01.
Are you sure you want to continue connecting (yes/no)?
choose yes
Screen Shot 2018-02-22 at 6.37.54 PM.png
You will now be prompted to enter your password. Please note that you will NOT see your cursor moving, or any characters typed (such as ******) when typing your password. This is a standard Terminal security feature. Hit enter

You can also copy and paste, using Command+V to paste.
Password:
Screen Shot 2018-02-22 at 6.38.24 PM.png
You are now logged into your server via SSH. You should see output like this:

Last login: Thur Feb 22 15:43:16 2018 from 103.223.313.123
############################################################
(mt) shortcuts
############################################################

Step 2: Install Apache
Apache is available within Ubuntu's default software repositories, so we will install it using conventional package management tools.

We will begin by updating the local package index to reflect the latest upstream changes. Afterwards, we can install the apache2 package:

sudo apt-get update
sudo apt-get install apache2

Step 3: Adjust the Firewall
During installation, Apache registers itself with UFW to provide a few application profiles. We can use these profiles to simplify the process of enabling or disabling access to Apache through our firewall.

Assuming that you followed the instructions in the prerequisites, you should have a UFW firewall configured to restrict access to your server.

We can list the ufw application profiles by typing:

sudo ufw app list

You should get a listing of the application profiles:

Output
Screen Shot 2018-02-22 at 6.55.53 PM.png

Available applications:
Apache
Apache Full
Apache Secure
OpenSSH

As you can see, there are three profiles available for Apache:

Apache: This profile opens only port 80 (normal, unencrypted web traffic)

Apache Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)

Apache Secure: This profile opens only port 443 (TLS/SSL encrypted traffic)

For our purposes, we will allow incoming traffic to the Apache Full profile by typing:

sudo ufw allow 'Apache Full'

You can verify the change by typing:
Screen Shot 2018-02-22 at 6.58.25 PM.png

You should see HTTP traffic allowed in the displayed output:
Screen Shot 2018-02-22 at 6.59.29 PM.png

As you can see, the profile has been activated to allow access to the web server.

Step 4: Check your Web Server
At the end of the installation process, Ubuntu 16.04 starts Apache. The web server should already be up and running.

When you have your server's IP address or domain, enter it into your browser's address bar:

You should see the default Ubuntu 16.04 Apache web page, which should look something like this:
Screen Shot 2018-02-22 at 7.02.19 PM.png

Conclusion
Now that you have your web server installed, you have many options for the type of content to serve and the technologies you want to use to create a richer experience.

Let me know if you would like to see more howto's like this!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-16-04

Thanks for the heads up!