A Comprehensive Guide to Setting Up the Apache HTTP Web Server: Step-by-Step Instructions for Beginners
Estimated time to read: 2 minutes
The Apache HTTP server is the most widely-used web server in the world. It provides many powerful features including dynamically loadable modules, robust media support, and extensive integration with other popular software.
Prerequisites:
- Red Hat Enterprise Linux 9 installed and configured.
- Basic knowledge of the Linux command line.
Installation
-
Installing on Fedora/CentOS/Red Hat Enterprise Linux
-
Installing on Ubuntu/Debian
-
If you use
firewalld
, open the TCP port80
in the local firewall -
Enable and start the
httpd
service
Managing the Apache httpd service
-
To start the
httpd
service -
To check the
httpd
status -
To stop the
httpd
service -
To restart the
httpd
service
Apache Httpd Webserver configuration file Structure
The httpd
, by default, reads the configuration files after start. You can see the list of the locations of configuration files in the table below.
Path | Description |
---|---|
/etc/httpd/conf/httpd.conf | The main configuration file. |
/etc/httpd/conf.d/ | An auxiliary directory for configuration files that are included in the main configuration file. |
/etc/httpd/conf.modules.d/ | An auxiliary directory for configuration files which load installed dynamic modules packaged in Red Hat Enterprise Linux. In the default configuration, these configuration files are processed first. |
Server Logs
In order to effectively manage a web server, it is necessary to get feedback about the activity and performance of the server as well as any problems that may be occurring. The Apache HTTP Server provides very comprehensive and flexible logging capabilities. This document describes how to configure its logging capabilities, and how to understand what the logs contain.
-
RHEL / Red Hat / CentOS / Fedora Linux Apache access file location