Secure (HTTPS) Apache with Let's Encrypt on CentOS 7

Apache MPM (Multi-Processing Modules) are Apache modules for creating child processes in Apache. There are many Apache MPM available, Each of them works in his own way. If you are using default Apache installation, Apache will use Prefork MPM by default.

Event MPM is launched with many improvements from worker MP. I prefer to use the Event MPM which is an improvement over the Worker MPM. Event MPM is that Event has a dedicated thread which handles all Keep Alive connections and requests.

It's common when using Apache for virtual hosts to create to different directories to storing the virtual host information. The first directory called sites-available will hold the configuration file for each virtual host. When we are ready to go live on the web with the virtual host information we will create a link to this file and place it in the sites-enabled directory. Both folders will be created in the '/etc/httpd' directory.

To create the sites-available folder issue the following command:

mkdir /etc/httpd/sites-available

To create the sites-enabled folder issue the following command:

mkdir /etc/httpd/sites-enabled

We now need to instruct Apache to look into the /etc/httpd/sites-enabled folder for the virtual host configuration files. Remember we will be creating the files in the sites-available folder, then placing a link to that file in the sites-enabled folder.

We will need to edit the '/etc/httpd/conf/httpd.conf' file by entering the command:

vi /etc/httpd/conf/httpd.conf

Scroll down to the bottom of the file and append the following line of code:

IncludeOptional sites-enabled/*.conf

Be sure to save the file. We will need to restart the Apache service for it to now read the files within the sites-enabled directory. I will do this at the end of the lesson after we have created the virtual host files and links.

To create the first virtual host file enter the following command in the terminal:

vi /etc/httpd/sites-available/example.com.conf

Now within this file we are going to use VirtualHost tags for each file. Enter the following information in the file:

Enable the Virtual Host Files

Now that we have web pages in each of the web sites we can enable the virtual hosts and reset the Apache web server. We will need to create a link from the sites-available folder to the sites-enabled folder for each domain.

To enable the example.com domain issue the following command in the terminal: