How to Install Apache2 HTTP Server on Ubuntu 17.10

Apache2 HTTP server is the most popular webserver in used today. It powers a lot of the websites you visit online. This brief tutorial shows students and new users how to install Apache2 webserver on Ubuntu 17.10.

Apache2 is a stable, production-ready HTTP server that can be used by anyone to create powerful and dynamic websites. It’s robust and includes features that makes it compatible with many modules and other programs and application.

This post should be short, easy to read and follow, even for new users.

Step 1: Install Apache2

Apache2 packages are available in Ubuntu default software repository, so all one has to do is run the apt commands to install it. To do that, run the commands below.

sudo apt update
sudo apt install apache2

Step 2: Allow HTTP Traffic

Now that Apache2 is installed, continue below to configure Ubuntu firewall to allow HTTP traffic. By default Ubuntu firewall isn’t enabled. However, in some cases the firewall is turned to security reasons.

If Ubuntu firewall is enabled, the single line commands below should allow HTTP traffic on both port 80 and port 443.

sudo ufw allow 'Apache Full'

If you check the firewall status, you should see that HTTP Full is allowed

sudo ufw status

The result should show that Apache2 HTTP traffic is allowed from anywhere, including v6 traffic.

Status: active

To Action From
-- ------ ----
Apache Full ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)

At this point, you should now be able to access Apache2 default website page if you browse to the server IP address or hostname. The default page should look like the one below.

apache2 ubuntu install

Apache2 is now fully installed and ready to be configured.

Step 3: Manage Apache2

The commands below allow you to stop, start, disable or enable Apache2 to always start up when the server boots up.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service
sudo systemctl disable apache2.service

Step 4: Apache2 Folders

When you install Apache2 HTTP server there will be additional folders created on your server. These folders contain configuration files, settings and other files. Below you’ll find some Apache2 folders and what they’re used for:

  • /etc/apache2/ –> Apache2 default configuration directory
  • /etc/apache2/sites-available/ –> Websites configuration files are stored here
  • /etc/apache2/sites-enable/ –> Websites configurations are enabled here
  • /var/www/html/ –> This is the default DocumentRoot for Apache2

The above directories are the most used on Ubuntu server.

This is how one installs Apache2 HTTP server on Ubuntu. Now you’ve installed Apache2, go ahead and dive into how to configure more advanced settings and how to host a website.


You may also like the post below:

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.