How to install Apache web server on Ubuntu 18.04?

ubuntu apache

Apache is an open source, cross-platform HTTP web server which implements the HTTP / 1.12 protocol and the notion of virtual site. The goal of this project is to provide a secure, efficient, and extensible server that provides HTTP services in sync with current HTTP standards.

Apache web server It is often used in combination with the MySQL database engine, the PHP scripting language, and other scripting languages. popular like Python and Perl. This configuration is called LAMP (Linux, Apache, MySQL and Perl / Python / PHP) and forms a powerful and robust platform for the development and distribution of web-based applications.

Apache installation process

Due to the great popularity of the application can be found within repositories of most Linux distributions, so its installation is quite simple.

In the case of Ubuntu 18.04 both desktop and server we will rely on the package that is within the repositories.

We only have to open a terminal and execute the following command:

sudo apt update

sudo apt install apache2

Solo we must confirm the installation and all the necessary packages for Apache operation will be installed on our computer.

Finished the process we only have to verify that it was installed correctly, for this on the terminal we execute:

sudo systemctl status apache2

Where we should receive a response similar to this:

Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)

With this we can see that the service was installed and is running correctly. Although we also have another method to verify this.

El another method is by requesting an Apache page, for this we only have to enter our ip address in our browser.

If they do not know the IP address of your computer, they can obtain it in different ways from the command line.

We only have to execute this command:

hostname -I

When doing so, we will be shown a list of them, they can go testing on the browser one by one, we can identify our IP address when the following is displayed in the browser:

apache_default

This is the Apache page that shows us that it is running on our computer and shows us the directory where it has some configuration files.

Basic Apache Commands

Already having the Apache web server running on our system, you need to know some basic commands of this, because with this we can start or stop the process if necessary.

The two most basic commands are to start and stop the service on our computer, for this only we must execute on the terminal when we want to start Apache:

sudo systemctl start apache2

While to stop Apache we execute:

sudo systemctl stop apache2

We also have the possibility of restart the service without stopping it, for this we only execute:

sudo systemctl restart apache2

Now another command that can be very useful when it is running and we require a process refresh, we can execute this command which will not disconnect the existing connections with the server:

sudo systemctl reload apache2

In case you want to disable the service we only execute:

sudo systemctl disable apache2

And for the opposite case in case of re-enabling the service in our team we only execute:

sudo systemctl enable apache2

Apache2 modules

Apache2 is a server that can be complemented by modules. Extended features are available through modules that can be loaded into Apache2. By default, a set of modules is included on the server at compile time.

Ubuntu compiles Apache2 to allow dynamic module loading. Configuration directives can conditionally include the presence of a module by including them in a block .

They can install more Apache2 modules and use them on their web server. For example, run the following command in a console to install the MySQL Authentication module:

sudo apt install libapache2-mod-auth-mysql

In the / etc / apache2 / mods-available directory you can check the add-on modules.

Apache has a large number of them, but if you want to know more I recommend read this section that the guys from Canonical share with us.


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.