Apache Web Server Start



Apache is a popular open-source, cross-platform web server that is, by the numbers, the most popular web server in existence. It’s actively maintained by the Apache Software Foundation.

Some high-profile companies using Apache include Cisco, IBM, Salesforce, General Electric, Adobe, VMware, Xerox, LinkedIn, Facebook, Hewlett-Packard, AT&T, Siemens, eBay, and many more (source).

  • Use the Debian package manager to install the apache2 package: sudo apt update && sudo apt -y install apache2 After installing Apache, the operating system automatically starts the Apache server. Overwrite the Apache web server default web page with the following command.
  • Configure the web server to start with each system boot using the chkconfig command. Sudo systemctl enable httpd To allow ec2-user to manage files in the default root directory for your Apache web server, modify the ownership and permissions of the /var/www directory. There are many ways to accomplish this task.
  • Set up an Apache web server on an EC2 instance. Set up an Apache web server on multiple EC2 instances by creating an Auto Scaling group. You can create multiple EC2 instances using Amazon EC2 Auto Scaling, an AWS service that allows you to increase or decrease the number of EC2 instances in a group according to your application needs.

Apache will execute, and will remain running until it is stopped by pressing Control-C. You can also run Apache via the shortcut Start Apache in Console placed to Start Menu - Programs - Apache HTTP Server 2.4.xx - Control Apache Server during the installation.

In addition to its popularity, it’s also one of the oldest web servers, with its first release all the way back in 1995. Many cPanel hosts utilize Apache today. Like other web servers, Apache powers the behind-the-scenes aspects of serving your website’s files to visitors.

Because Apache doesn’t perform as well in some benchmarks, especially for static websites or websites with high traffic, Kinsta uses the NGINX web server instead of Apache. Though NGINX hasn’t been around for as long as Apache, it’s quickly grown in popularity and market share since its launch in 2004.

How Does Apache Work? Web Server Basics Explained

While there’s a lot of complexity underpinning how a web server functions, the basic job of all web servers is to accept requests from clients (e.g. a visitor’s web browser) and then send the response to that request (e.g. the components of the page that a visitor wants to see).

The Apache web server has modules which add more functions to its software, such as MPM (for handling multi-processing modes) or mod_ssl for enabling SSL v3 and TLS support (suggested reading: TLS vs SSL). Some common features seen in Apache include:

Apache Web Server Cannot Start Ubuntu

  • IPv6
  • FTP
  • Perl, Lua, and PHP
  • Bandwidth throttling
  • WebDAV
  • Load balancing
  • URL rewriting
  • Session tracking
  • Geolocation based on IP address

While a web server is an essential part of any website, it’s important to note that casual WordPress users are unlikely to interact with their web server directly most of the time.

Apache vs Nginx Usage Stats

When you look at every single website on the Internet, Apache is the most popular web server. It powers 47% of the websites with a known web server, according to W3Techs.

However, Apache’s usage greatly drops when you start looking at the web’s most highly trafficked sites. Apache only powers:

  • 27.1% of the 100,000 most popular sites
  • 21.5% of the 10,000 most popular sites
  • 16.2% of the 1,000 most popular sites

This drop-off likely stems, at least in part, from Apache’s lower benchmarks for high traffic websites.

Conversely, NGINX, the web server that Kinsta uses, is used by a majority of high-traffic sites, powering:

  • 56.1% of the 100,000 most popular sites
  • 63.2% of the 10,000 most popular sites
  • 57% of the 1,000 most popular sites
Settings

If you check the Google Search trends since 2004, you can see this trend play out where Apache’s popularity (as a search term) is decreasing while NGINX’s is creeping up.

How To Check Which Web Server You’re Using

If you want to see whether you’re using Apache or NGINX, you can often (but not always) look at your site’s HTTP header.

To view your site’s HTTP header, you can:

  • Use the Network tab of Chrome Developer Tools
  • Use a tool like Pingdom or GTmetrix

Apache HTTP header

This method may not work if you’re using a service like Cloudflare, though.

Apache and the Apache feather logo are trademarks of The Apache Software Foundation.

If you enjoyed this tutorial, then you’ll love our support. All Kinsta’s hosting plans include 24/7 support from our veteran WordPress developers and engineers. Chat with the same team that backs our Fortune 500 clients. Check out our plans

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.

Note : The post uses RHEL/CentOS 7 distribution to install and configure the Apache server. Although the start/stop/install commands may differ but the configuration steps are same in all the linux distribution
List of web servers

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.

Web

Apache Server For Linux

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 Web Server Setup

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 Website Setup

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.

Start Apache Web Server Linux

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.

Apache Web Server Restart

The following example is a simple name-based virtual hosts configuration: