Apache HTTP Server
What is Apache?
Apache HTTP Server is commonly referred to as Apache and it is one of the popular open-source, cross-platform web server. It is actively maintained by the Apache Software Foundation. Several high-profile companies such as Cisco, Siemens, IBM, Salesforce, Xerox, Adobe etc use the services provided by Apache HTTP Server. It is also one of the oldest web servers. Even with popularity and wide usage, it is not reliable for static websites or websites with high traffic. This has led to the growth of Nginx web server.
Architecture
Apache is one of the component that is required in the web development stack. One such common web development stack is Linux, Apache, MySQL, PHP - or more popularly known as LAMP stack. All the operations of this application would be handled by Linux Operation System. Here, Apache processes the requests and serves the web assets and content via HTTP. MySQL is the database system allowing users to store and retrieve information. And PHP is the programming language that helps apache to create web content.
A good chunk of web applications available today runs on LAMP stack. Most web application have similar architecture though they serve many different functions and purposes. They also benefit from serveral other services such as Load Balancers, Firewalls, CDNs, Database Servers etc. The firewall helps protect the web app from security vulnerabilities both internal and external. Load Balancers help distribute traffic across the web servers that handle the HTTP(S) requests and application servers. The database servers handle asset storage anf backups. Depending on the architecture, this database server may be placed within the same server, however it is recommended to keep it separate from the internal server.
Why Apache?
The source code of Apache web server is freely available for viewing and collaboration. It means that Apache is an open source software. Due to this fact, Apache is very popular among developers who have built and configured their own modules to apply specific functionality and improve on its core features. Apache basically allows the users/developers to modify and use the code in which ever way they want. It is also made possible for developers to remove unwanted modules that does not help them develop their web applications, hence making it more lightweight and efficient.
Some popular modules that could be added are SSL, PHP (Server side programming support), Load Balancing config etc. One prominent speciality of Apache is the it is platform independenet and can be deployed on wide wide variety of Operating Systems such as Linux, Windows and MacOS. It also would mean that if you learn how to configure Apache on Linux, you can administer Apache on Windows and Mac too. The only difference would be directory paths and installation processes.
Features
- Handling of static files
- Loadable dynamic modules
- Auto-indexing
- .htaccess
- Compatible with IPv6
- Supports HTTP/2
- FTP connections
- Gzip compression and decompression
- Bandwidth throttling
- Perl, PHP, Lua scripts
- Load balancing
- Session tracking
- URL rewriting
- Geolocation based on IP address
How does it work?
Apache acts as a means of communication over network using the TCP/IP protocol. A variety of protocols could be used along with Apache, but the most common one is HTTPS. HTTPS is one of the main web protocols and the one Apache is most known for. HTTPS helps define how messages are formatted and tranmitted across the web with instructions for browsers and servers as to how various requests and commands should be responded and handled. It uses the port 443, and the unsecured version HTTP uses the port 80. The config files are used to configure the Apache server where the modules are used to control the behaviour. Apache listens to the IP address configured in its config files that are being requested.
The binary code used in Apache is httpd under Unix and apache.exe under Win32 systems. This runs in the background. Sometimes due to large memory consumption of HTTP, alternatives such as light httpd or Nginx is used especially when the traffic is high. Apache receives requests from TCP port, and fullfils the requested process accordingly.
In a nutshell, Apache HTTP servers are quite popular and are used by about ~67% of all web servers in the world. It is very easy to customise the environments and are fast, and highly reliable.
Advantages
Lets look at some of the advantages of using Apache HTTP servers :
- Apache is free to use
- Allows developers to modify the source code as per their requirements
- Allows users to add or remove modules
- Highly reliable
- Can be installed quite easily
- Platform independent
- The original code base in regularly maintained and updated
- Has clear and extensive documentation
- It is flexible in nature
Disavantages
- Has the probability of serious security threats if firewalls are not configured properly
- New bugs may be introduced when developers add thier own modules
- Requires a strict updating policy that needs to be done regularly without fail
- It is a process based server
- Performance may deteriorate when the traffic is high
Some alternative platforms
Several other web servers are also available in the market that could be freely explored, some of them are :
- Apache Tomcat
- Node.js
- Nginx
- Lighttpd
Final thoughts
Throughout the last few decades, Apache has proven to be a staple in many popular stacks and the backbone of the early internet year. It plays a pivotal role in many companies system infrastructure. Even though several other technologies and servers are being born every other day, Apache is definitely a technology that every developer should know of.