Skip to main content

How To Install Apache HTTP Web Server On Ubuntu

YouTube Video

INTRODUCTION


Apache Web Server is an open source software package. This means it can be used freely without requiring any purchases.
The official name is Apache HTTP Server.
It is a software package that turns a computer into an HTTP web server. This means that it sends web pages stored as HTML files to users who request them on the internet.
It runs on 67% of all web servers in the world. It is fast, reliable and secure. It can be highly customized to meet the needs of different environments using modules and extensions.
This guide will help you install the Apache Web Server on Ubuntu.

Prerequisites
  • A computer running Ubuntu Operating System 18.04 LTS (Bionic Beaver)
  • Good/stable Internet Connection
  • A user account with sudo or root privilege
Tools Needed
  • Terminal or Command line (Ctrl + Alt + T)
  • A firewall. The default Ubuntu Firewall is okay. (UFW - Uncomplicated Firewall)
  • The apt package manager which is installed by default on Ubuntu.
Installation Procedure
Before installing new software, it is necessary to update your local software package database in order to ensure that you are accessing the latest versions.
It helps prevent zero day exploits against outdated software and also saves on the time used to update after installation.
Open the terminal (Ctrl + Alt + T) or right click on the desktop and click open terminal and type the following command:
 sudo apt-get update  
Wait for the package manager to finish updating. Shouldn't take long
Install Apache 
Install the Apache package on Ubuntu using the following command:
 sudo apt-get install apache2 -y  
Verify Apache installation
Open a web browser and type in the address bar
 http://local.server.ip  
Replace the local.server.ip with the IP address of your server. To get the IP address of your server, type the folowing command exactly as it is into your terminal or command line
 hostname -I | awk '{print $1}'  
The resulting output will be your server's IP address
For example 192.168.0.1
The web browser should open the Apache2 Ubuntu Default Page.
Configure Your Firewall
At this point, the Apache installation process is complete.
This additional step configures the default UFW firewall to allow traffic
on port 80
First, display the available app profiles on UFW
Type the following into your terminal or command line        
 sudo ufw app list  
The output should be a list of all available application profiles as shown
below List shown varies with kind of apps installed on your computer
Use the following command to allow normal web traffic on port 80
 sudo ufw allow 'Apache'  
Verify the changes by checking the UFW status
 sudo ufw status  
If the status shows inactive. The firewall is not enabled. Use the following
command to enable it
 sudo ufw enable  
Then run
 sudo ufw status  
again. It should show active status as in the 
image above.
If you have other applications or services to allow,make sure you 
configure your firewall to allow traffic.
For example, using the
 sudo ufw allow 'OpenSSH'  
ensures secure encrypted logins over the network. The Apache Service on Ubuntu is now up and running

Apache Configuration
Apache Service Controls
It is helpful to have some level of control over the Apache Service while 
managing it. This is necessary because you'll be reloading and restarting Apache quit frequently as you make configuration changes and test them. You also need to know how to start and stop Apache service as needed. This operation uses the systemctl command with a series of switches Start Apache
 sudo systemctl start apache2.service  

Stop Apache
 sudo systemctl stop apache2.service  
Restart Apache
 sudo systemctl restart apache2.service  
Reload Apache
 sudo systemctl reload apache2.service  
Apache Configuration Files, Directories and Modules
To make content available online, you need to know how to configure  files, directories and modules. Directories
By default, Apache creates a document root directory at
 /var/www/html  

Any files placed into this directory are available to Apache to distribute
over the network.
This is therefore the place where you copy the web page files that you
want to publish.
This is also where you install content management systems such as
WordPress.
Configuration Files
Now that we know that web content is stored in the /var/www/html 
directory, we can create sub directories within this location for each 
different website hosted on your server.
Apache creates log files for any errors it generates in the file 
/var/log/apache2/access.log.
It also creates access logs for its interactions with clients in the file 
/var/log/apache2/access.log
Apache functions through the use of configuration files just like many 
other Linux-based applications
They are located in the /etc/apache2/ directory
A list of other essential directories include:
  • /etc/apache2/apache2.conf - This is the main Apache configuration file and controls everything Apache does on your system.Changes done here affect all the websites hosted on the machine.
  • /etc/apache2/ports.conf - This is the ports configuration file. You can use it to customize the ports Apache monitors. Port 80 is configured for HTTP traffic by default.
  • /etc/apache2/sites-available - This is a storage for Apache virtual host files. A virtual host allows one to run more than website on a single machine.
  • /etc/apache2/sites-enabled - This directory holds websites that are ready to serve clients. The a2ensite command is used on a virtual host file in the sites-available directory to add sites to this location. 
     More details on directories and configuration files are in the Apache Ubuntu Documentation
Modules
These are applications that enhance or expand the functionality of Apache.
You can enable these software modules use the following command
 sudo a2enmod name_of_module  
Disable the module using
 sudo a2dismod name_of_module  

If this guide was helpful or you encountered any problems
please leave a comment below

Comments

  1. What about installing Apache HTTP?

    ReplyDelete
    Replies
    1. It's the same thing. It's called the Apache Web Server which uses HTTP

      Delete
  2. nice job

    looking forward for the next article

    ReplyDelete

Post a Comment

Your input is valued. Please type something....

Popular posts from this blog

Fun Terminal Commands Every Linux User Should Try

Accessing Maps from the terminal with MapSCII Requirements Telnet installed Internet Connection Firewall is disabled You can do this on Linux, Unix, Mac OS X or Windows with an app like PuTTY or the Windows 10 Linux bash shell or any Os that supports telnet. Open terminal and write the command below. telnet mapscii.me Hit enter and you're ready to browse and enjoy MapSCII. Navigate using the keyboard or mouse. Use the following keys on your keyboard Arrow keys: up, down, right, left A to zoom in Z to zoom out C toggles ASCII mode on/off You can also click and drag and hold on the map with your cursor. If your connection dropped without a reason, reconnect with telnet -E mapscii.me and use only cursors, A and Z to navigate. The Mapscii project is open source and you can install it locally if you'd like. Check out their project here on GitHub . The Dancing ASCII Party Parrot Requirements Curl installed Internet

SQL for Data Analysis - Udacity

  Entity Relationship Diagrams An  entity relationship diagram  (ERD) is a common way to view data in a database. Below is the ERD for the database we will use from Parch & Posey. These diagrams help you visualize the data you are analyzing including: The names of the tables. The columns in each table. The way the tables work together. You can think of each of the boxes below as a spreadsheet. What to Notice In the Parch & Posey database there are five tables (essentially 5 spreadsheets): web_events accounts orders sales_reps region You can think of each of these tables as an individual spreadsheet. Then the columns in each spreadsheet are listed below the table name. For example, the  region  table has two columns:  id  and  name . Alternatively the  web_events  table has four columns. The "crow's foot" that connects the tables together shows us how the columns in one table relate to the columns in another table. In this first lesson, you will be learning the bas

Impressive - Check if Your Email Address Has Been Hacked - Free,Easy Tutorial

haveibeenpwned.com Data breaches are rampant and many people don't appreciate the scale or frequency with which they occur. A "breach" is an incident where data is inadvertently exposed in a vulnerable system, usually due to insufficient access controls or security weaknesses in the software. How is the legitimacy of a data breach established? Attackers often give "breach" announcements, which are later revealed to be hoaxes. There is a delicate balance to be struck between making data searchable as soon as possible and conducting proper due diligence to confirm the breach's validity. In order to verify the authenticity of a violation, the following steps are normally taken: Has the affected provider made a public statement about the security breach? Does the information stolen in the breach show up in a Google search (i.e., it was simply copied from another source)? Is the structure of the data consistent with what you'd expect to see in a breach? Have