Apache Web Server: What is it?

Posted: March 26th, 2018

 

When you put in a webpage address, your browser navigates to a server. That server is a computer, but in order to send and process the request it requires software. This software is called a Web Server or more precisely an HTTP Server. There are lots of different brands, just like operating systems. Apache is one of the oldest and most reliable. It can be run on Linux, Unix, and Windows. A hosting company may be using Apache. Yes you would your html files and images into certain folders so the web server would know what to send for a requested page.

 

The Apache HTTP Server, colloquially called Apache (/əˈpætʃiː/ ə-PATCH-ee), is a free and open-source cross-platform web server, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.

 

The Apache HTTP Server is cross-platform; as of 1 June 2017 92% of Apache HTTPS Server copies run on Linux distributions.[5] Version 2.0 improved support for non-Unix operating systems such as Windows and OS/2.[6] Old versions of Apache were ported to run on OpenVMS and NetWare.

 

Originally based on the NCSA HTTPd server, development of Apache began in early 1995 after work on the NCSA code stalled. Apache played a key role in the initial growth of the World Wide Web,[8] quickly overtaking NCSA HTTPd as the dominant HTTP server, and has remained most popular since April 1996. In 2009, it became the first web server software to serve more than 100 million websites.[9] As of July 2016, it was estimated to serve 46% of all active websites and 43% of the top million websites

 

How to Install Apache on Ubuntu and Debian

 

If you do not already have Apache installed, you can do so now by issuing the following commands:

 

    sudo apt-get update

    sudo apt-get install apache2

 

This is all that is necessary to have a working web server. If you visit your VPS's IP address in a web browser, you will get the default Apache index page:

 

    your_domain_name_or_ip_address

 

 

The Apache File Hierarchy in Ubuntu and Debian

 

On Ubuntu and Debian, Apache keeps its main configuration files within the "/etc/apache2" folder:

 

    cd /etc/apache2

    ls -F

 

    apache2.conf  envvars     magic            mods-enabled/  sites-available/

    conf.d/       httpd.conf  mods-available/  ports.conf     sites-enabled/

 

There are a number of plain text files and some sub-directories in this directory. These are some of the more useful locations to be familiar with:

 

    > apache2.conf: This is the main configuration file for the server. Almost all configuration can be done from within this file, although it is recommended to use separate, designated files for simplicity. This file will configure defaults and be the central point of access for the server to read configuration details.

 

    > ports.conf: This file is used to specify the ports that virtual hosts should listen on. Be sure to check that this file is correct if you are configuring SSL.

 

    > conf.d/: This directory is used for controlling specific aspects of the Apache configuration. For example, it is often used to define SSL configuration and default security choices.

 

    > sites-available/: This directory contains all of the virtual host files that define different web sites. These will establish which content gets served for which requests. These are available configurations, not active configurations.

 

    > sites-enabled/: This directory establishes which virtual host definitions are actually being used. Usually, this directory consists of symbolic links to files defined in the "sites-available" directory.

 

    > mods-[enabled,available]/: These directories are similar in function to the sites directories, but they define modules that can be optionally loaded instead.

 

As you can see, Apache configuration does not take place in a single monolithic file, but instead happens through a modular design where new files can be added and modified as needed.

 

Looking at the Apache2.conf File

 

The main configuration details for your Apache server are held in the "/etc/apache2/apache2.conf" file.

 

This file is divided into three main sections: configuration for the global Apache server process, configuration for the default server, and configuration of Virtual Hosts.

 

In Ubuntu and Debian, the majority of the file is for global definitions, and the configuration of the default server and virtual hosts is handled at the end, by using the "Include ..." directive.

 

The "Include" directive allows Apache to read other configuration files into the current file at the location that the statement appears. The result is that Apache dynamically generates an overarching configuration file on startup.