The Apache HTTP Server, an open-source web server developed by the Apache Software Foundation. The Apache server is used to host web content. It responds to requests for content from web browsers, such as Internet Explorer and Firefox. Note: The post uses RHEL/CentOS 7 distribution to install and configure the Apache server. Two popular web servers are Apache and IIS. Tomcat is a Java Servlet / JSP container that can also be used as a standalone web server. Apache, IIS and Tomcat are the most commonly used software for hosting WAP / web sites. Apache - Open-source, Free WAP / Web Server. Apache is a very professional open-source WAP / web server.
Apache HTTP Server 2.4.46 (httpd): 2.4.46 is the latest available version 2020-08-07. Source as gzip with LF line endings: modfcgid-2.3.9.tar.gz PGP. Apache is a process-based, modular, open-source web server application designed to establish a new thread for each connection occurring simultaneously. Apache supports a range of functionalities, covering everything from authentication mechanisms to server-side programming languages.
The Apache HTTP Server—known as Apache web server or simply Apache—is considered the standard for general-purpose HTTP activities and services. It offers a wide range of modules to deliver optimum flexibility in support of URL rewriting, proxy servers, and granular access management and control. Apache is a popular choice among web developers because it uses CGI, embedded interpreters, and FastCGI to support server-side scripting. This allows for the rapid and effective execution and implementation of highly dynamic coding.
There are plenty of well-known Apache alternatives—nginx, XAMPP, Caddy, and Microsoft IIS, among many others—but none of them offer the same breadth of usage provided by Apache. Apache is so widely used it has more than a 50% share in the commercial web server marketplace. It’s especially popular for use with Unix-like operating systems, although it supports most platforms. This includes Windows, OS X, OS/2, and others.
A Simple Definition of Apache
How to Set Up Apache Server
How to Set Up Apache Server in Linux
How to Set Up Apache Virtual Servers
The Best Apache Server Monitoring Tool
However, Apache’s flexibility and breadth of usage come at the expense of simplicity in many cases. The configuration structure is complex, and many of the advanced functionalities are difficult to use. This Apache server tutorial will explain the basics of Apache, providing instructions for Apache web server configuration in Linux, step by step. The aim is to help you not only set up Apache server, but also monitor it. My recommended tool for this purpose is SolarWinds® Server & Application Monitor for Apache.
Apache Web Server Open Source Software
A Simple Definition of Apache
Apache is a process-based, modular, open-source web server application designed to establish a new thread for each connection occurring simultaneously. Apache supports a range of functionalities, covering everything from authentication mechanisms to server-side programming languages. It also supports virtual hosting, allowing you to use one Apache web server to serve multiple websites. Most Apache capabilities are delivered as individual modules, allowing you to extend and enhance Apache’s core utilities.
How to Set Up Apache Server
You may find yourself becoming overwhelmed as you start to set up Apache server. As an open source, advanced application capable of a wide range of functions, Apache web server configuration and setup is fairly complex.
You can install and set up Apache server in two ways.
- Vendor-based installation. As it’s an open source web application, anyone can make an installer to suit their individual environment. Vendors like Red Hat, SUSE, and Debian have used this capability to customize Apache server configuration and file location by taking the base operating system and other installed programs into account.
- Source code installation. The alternative to using a vendor-based installer is to set up Apache server by building and installing directly from the source code. This approach enables you to set up Apache server in platform-independent manner available for all operating systems.
With both installation options, modules can be compiled in the form of a dynamic shared object, or DSO. A DSO is an object file capable of being shared and utilized by numerous applications. DSO modules are separate from the core Apache file. The DSO approach to compiling modules is popular because it makes adding, updating, and removing modules easy.
How to Set Up Apache Server in Linux
This Apache server tutorial will now provide instructions for Apache web server configuration in Linux, step by step.
- Update your system repositories. This involves downloading the most recent version of a software by updating the Ubuntu repositories’ local package index. To do this, go to the terminal and enter the command “$ sudo apt update” into it.
- Install Apache by using the “apt” command. For this example, let’s use Apache2. Just input the following command— “$ sudo apt install apache2” —as sudo, which will install Apache2 and all necessary dependencies. At this stage, you may be asked whether you want to continue the installation process. Enter “Y” to indicate you would like to, and installation will begin.
- Verify Apache has been successfully installed. When the installation procedure has finished, check the version number to confirm Apache2 is now installed on your system. Enter “$ apache2 -version” to do this. The server version will appear, hopefully confirming Apache2 has been installed.
How to Set Up Apache Virtual Servers
When using virtual hosts, it’s important to undertake virtual server Apache configuration. Modifying configuration settings will ensure they reflect the domain specifics, which will allow Apache to respond to domain requests correctly and successfully. The process for completing virtual server Apache configuration is simple:
- First, input “$ sudo nano /etc/apache2/sites-available/example.com.conf” to open your virtual host configuration file.
- Replace “example.com” appropriately. Next, you’ll be able to modify the following:
ServerName example.com
ServerAdmin admin@example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_htmlAgain, be sure to replace all example components with the appropriate information. When modified, the end result should resemble the following:
<VirtualHost *:80>
ServerName example.com
ServerAdmin admin@example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost> - If an error occurs, reference these instructions to ensure nothing has been mistyped or inputted incorrectly.
Best Apache Server Monitoring Tool
After setting up Apache web server, I highly recommend the use of a monitoring tool to help you test Apache server and monitor it effectively. There are several such tools on the market, but SolarWinds Server & Application Monitor (SAM) tops my list. This tool allows you to easily define specific performance metrics to facilitate proactive monitoring of Apache Cassandra, Apache Geronimo, and Apache Tomcat. The single application is capable of monitoring and managing your entire Apache environment, and the underlying infrastructure of the server.
Apache Web Server Configuration
With SAM, monitoring uptime and performance is easy, as is diagnosing the root of performance issues. The application facilitates proactive monitoring of all web server supporting components contributing to the Apache web server, including Linux and MySQL. Application monitoring covers the virtual layer, servers, and applications like Microsoft SQL Server, Exchange, and Active Directory. The system benefits from customizable alerts, reports, and easy-to-navigate dashboards ready to use out of the box. This means you can get up and running when SAM is installed, without having to create or modify dashboards.
The dashboards themselves have been cleverly designed, with data represented in the form of graphs and charts whenever appropriate, to give you immediate insight into key metrics and information without overloading or cluttering the interface.
SAM is a scalable and highly feature-rich application, requiring zero training or experience to start using, and is suitable for extensive enterprise-grade requirements. The user-friendly interface is one of SAM’s best features, as it makes data interpretation dynamic and accurate. This program simplifies the Apache monitoring experience, allowing you to test and interrogate it in a few simple clicks. The implementation process is simple, and SolarWinds support technicians are available on a 24/7 basis.
With the unified, centralized dashboard and ample support offered by SolarWinds, using this application couldn’t be easier. SolarWinds SAM also serves as a wider application and server monitoring solution, with its monitoring capabilities extending to Active Directory, agentless servers, application dependency, AWS, Azure IaaS, and much more. What’s great is you can download a no-risk 30-day free trial to try out the fully featured software before making a commitment.
Apache HTTP server
The Apache HTTP Server, an open-source web server developed by the Apache Software Foundation. The Apache server is used to host web content. It responds to requests for content from web browsers, such as Internet Explorer and Firefox.
Installing Apache
To configure your system as a web server, begin by installing the httpd software package.
Use the systemctl utility to enable the HTTP daemon to start at boot time and also to start the daemon immediately.
Configuration files
The main configuration file for Apache is /etc/httpd/conf/httpd.conf. An auxiliary directory, /etc/httpd/conf.d, also exists to store configuration files that are included in the main configuration file. Configuration files that load modules are in the /etc/httpd/conf.modules.d directory.
New apachectl subcommands in CentOS / RHEL 7
A new apachectl sub-commands are available in CentOS / RHEL 7. The following example uses the configtest subcommand to check the configuration for possible errors.
Use the graceful subcommand to reload the configuration without affecting active requests.
Configuring Apache
The main configuration file for Apache is /etc/httpd/conf/httpd.conf. Apache runs as installed, but you can modify configuration directives in this file to customize Apache for your environment. Some of these directives are described in the post below.
Testing Apache HTTP server
You can confirm that Apache is working by pointing a browser on the local system to http://localhost as shown in the picture below. You can also point a browser to http:// followed by the IP Public address of the server or the ServerName directive that you specified in the configuration file. The test page shown below confirms the functioning Apache HTTP server.
To test the display of actual content, create an HTML file named index.html in the directory specified by the DocumentRoot directive (the default directory is /var/www/html). Apache automatically displays the index.html file in this directory, if it exists.
Apache Containers
Apache containers are special configuration directives that group other directives. The containers use XML-style tags, meaning that the beginning of a container is <name> and the end is </name>. An index of all the container directives is available at http://httpd.apache.org/docs/current/sections.html. Refer the post below to get the most commonly used apache containers.
Apache Virtual Hosts
Apache supports virtual hosts, meaning that a single Apache server can respond to requests directed to multiple IP addresses or host names. Each virtual host can provide content and be configured differently.
You can configure virtual hosts in two ways:
1. IP-based Virtual Hosts (host-by-IP)
2. Name-based Virtual Hosts (host-by-name)
host-by-IP
With host-by-IP, each virtual host has its own IP address and port combination. The Apache web server responds to the IP address that the host resolves as. Host-by-IP is required for serving HTTPS requests due to restrictions in the Secure Sockets Layer (SSL) protocol.
host-by-name
With host-by-name, all virtual hosts share the common IP address. Apache responds to the request by mapping the host name in the request to ServerName and ServerAlias directives in the particular virtual host’s configuration file.
Use the <VirtualHost host-name> container to implement virtual hosts. After the first VirtualHost is defined, all of the content served by Apache must also be moved into virtual hosts.
The following example is a simple name-based virtual hosts configuration: