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.
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 longInstall 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
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 theensures secure encrypted logins over the network. The Apache Service on Ubuntu is now up and running
sudo ufw allow 'OpenSSH'
Apache ConfigurationApache Service ControlsIt is helpful to have some level of control over the Apache Service whilemanaging 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 Apachesudo systemctl start apache2.service
Stop Apachesudo systemctl stop apache2.service
Restart Apachesudo systemctl restart apache2.service
Reload Apachesudo systemctl reload apache2.service
Apache Configuration Files, Directories and ModulesTo make content available online, you need to know how to configure files, directories and modules. DirectoriesBy default, Apache creates a document root directory at
/var/www/html
Any files placed into this directory are available to Apache to distributeover the network.This is therefore the place where you copy the web page files that youwant to publish.This is also where you install content management systems such asWordPress.Configuration FilesNow that we know that web content is stored in the /var/www/htmldirectory, we can create sub directories within this location for eachdifferent 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.logApache functions through the use of configuration files just like manyother Linux-based applicationsThey are located in the /etc/apache2/ directoryA 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
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
What about installing Apache HTTP?
ReplyDeleteIt's the same thing. It's called the Apache Web Server which uses HTTP
Deletenice job
ReplyDeletelooking forward for the next article