Just A Service

Apache2 HTTP Server

in 10 Minutes or less.

This is an overview of the tool and their key functionalities, so you can figure out its potential, get an idea, and you can check later every detail deeply in the corresponding source.

Apache is a http web server application that allows to handle all http requests in your server (or computer) taking in account details such as security, routing, giving the ability to work with other programs such as php to create dynamic pages, and even have multiple web pages inside of the same servers.

visit https://httpd.apache.org/ to get more information.

Installing Apache

You can install apache in a wide list of operative systems as linux distributions, mac and windows. In my experience for linux you only need to execute a command line in the corresponding package manager (ie. Ubuntu has apt), in Mac is common with homebrew, and Windows usually has a couple of third party bundles that includes apache as a part of a whole solution (ie wamp server apache+php+mysql).  

Look for the specific solution of your OS. There are tons of manuals to achieve it. Additionally apache has a download page with general instructions to guide you. You can find more details in the following link https://httpd.apache.org/download.cgi

Key Concepts

modules

By default apache only supports static web pages, but you can extend the core functionalities with modules, there are modules for different server activities such as control and manage the urls like mode_alias that is a built-in module, and there are some other modules created by third parties as php_module to interpret php for building dynamic web pages.

In a few words, you can extend the functionalities of the apache server through modules. In the following link you can see the built-in modules included in apache 2.4 https://httpd.apache.org/docs/2.4/mod/. If you need some extra behavior or functionality, try to find third party modules (it usually explains how to add and set up in apache).

Configuration files

There is a main configuration file for the server, where you can define everything you need, but after installation, it’s very common to see multiple configuration files in different folders, this is achieved through a single word ‘include’ inside of the main configuration files; as you can guess, you can define the structure of the configuration files and folders that makes senses for you , or just keep the structure you got after the installation.

At my last installation using Ubuntu, these are of some of the folders and files I got:

Configuration Folder: /etc/apache2/
Main Configuration File: /etc/apache2/apache2.conf
Available Configuration site files: /etc/apache2/sites-available
Server web root folder: /var/www/

For more details about configuration files, please check the following link for version 2.4 https://httpd.apache.org/docs/current/configuring.html

Finally we have .htaccess, which is an extra configuration file that you can add inside of the webpages folders projects; this file allows you to set up and override some configurations specifically to the folder (or project). To use this kind of configuration, in the main configuration server for the project you must enable ‘AllowOverride All’. you can follow this tutorial for more details https://httpd.apache.org/docs/2.4/howto/htaccess.html 

Virtualhosts

Virtualhosts is one the key functionalities that we have in apache, with virtualhosts, we can have multiple web servers inside our apache instance, we can define projects by subdomains or ip, access ports, etc. You can get detailed information here for version 2.4 https://httpd.apache.org/docs/2.4/vhosts/ 

Console Commands

There are a couple of commands you can use for control the server, the mainly apachectl, which this command you can start, restart and stop the server. You can find the list of commands (programs) in the following link https://httpd.apache.org/docs/current/programs/

Additionally some distributions such as Ubuntu comes with extra commands as a2ensite. Refer to your OS or bundle to see what extra useful commands or utilities you can use to interact with your apache server.

Conclusion

You can use apache to serve web pages and configure according to your needs. I recommend reading the following tutorial. This is specific to Ubuntu, but you can get an idea of the whole process from the installation to serving and setting up a virtualhost.

Thank you for reading.

Comments

Leave a Reply

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