Verify Apache HTTP Server "httpd" Environment

This section provides a tutorial example on how to verify key areas of the Apache HTTP Server 'httpd' environment on Linux systems.

In order to manage Apache HTTP Server, httpd, you need to remember a number of key areas of its running environment:

1. Software package - httpd: The latest version is 2.4.37.

herong$ dnf info httpd

Installed Packages
Name         : httpd
Version      : 2.4.37
Release      : 16.module_el8.1.0+256+ae790463
Architecture : x86_64
Size         : 5.4 M
Source       : httpd-2.4.37-16.module_el8.1.0+256+ae790463.src.rpm
Repository   : @System
From repo    : AppStream
Summary      : Apache HTTP Server
URL          : https://httpd.apache.org/
License      : ASL 2.0
Description  : The Apache HTTP Server is a powerful, efficient, and
             : extensible web server.

2. System service - httpd: It should be "active" and "running".

herong$ sudo systemctl status httpd

- httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; ...)
   Active: active (running) since Sun 2022-05-22
  ...

3. Background processes - httpd: You should see one root process and several child processes waiting to handle client requests.

herong$ ps -elf | grep httpd
F S UID          PID    PPID  ... CMD
4 S root       36626       1  ... /usr/sbin/httpd -DFOREGROUND
5 S apache     36627   36626  ... /usr/sbin/httpd -DFOREGROUND
5 S apache     36628   36626  ... /usr/sbin/httpd -DFOREGROUND
5 S apache     36629   36626  ... /usr/sbin/httpd -DFOREGROUND
5 S apache     36630   36626  ... /usr/sbin/httpd -DFOREGROUND

4. Network service and port - http 80/tcp: This is the default. You can change it in the configuration file.

herong$ nmap localhost

PORT    STATE SERVICE
...
80/tcp  open  http
...

5. Log file - /var/log/httpd/access_log: This is the default. You can change it in the configuration file.

herong$ sudo tail /var/log/httpd/access_log

... "GET / HTTP/1.1" 403 4006 "-" "curl/7.61.1"
... "GET / HTTP/1.1" 403 4288 "-" "Mozilla/5.0 (X11; Linux x86_64; ...
... "GET /noindex/common/css/bootstrap.min.css HTTP/1.1" 200 99548 ...
... "GET /noindex/common/css/styles.css HTTP/1.1" 200 71634 ...
... "GET /noindex/common/images/pb-centos.png HTTP/1.1" 200 13122 ...
... "GET /noindex/common/images/pb-apache.png HTTP/1.1" 200 103267 ...
... "GET /noindex/common/images/centos-header.png HTTP/1.1" 200 28888 ...

6. Web page file root location - /var/www/html/: This is the default. You can change it in the configuration file.

herong$ ls -la /var/www/html/

drwxr-xr-x. 2 root root  6 Apr 1 2022 .
drwxr-xr-x. 4 root root 33 Apr 1 2022 ..

7. Configuration files - /etc/httpd/: This is the default. You can change it in the configuration file.

herong$ ls -l /etc/httpd/

drwxr-xr-x. 2 root root  37 conf
drwxr-xr-x. 2 root root  82 conf.d
drwxr-xr-x. 2 root root 226 conf.modules.d
lrwxrwxrwx. 1 root root  19 logs -> ../../var/log/httpd
lrwxrwxrwx. 1 root root  29 modules -> ../../usr/lib64/httpd/modules
lrwxrwxrwx. 1 root root  10 run -> /run/httpd
lrwxrwxrwx. 1 root root  19 state -> ../../var/lib/httpd

9. Program files - /usr/sbin/httpd and /usr/lib64/httpd/:

herong$ sudo ls -l /usr/sbin/httpd
-rwxr-xr-x. 1 root root 579840 Nov 12 2021 /usr/sbin/httpd

herong$ sudo ls -l /usr/lib64/httpd/
drwxr-xr-x. 2 root root 4096 Apr 1 2022 modules

herong$ sudo ls -l /usr/lib64/httpd/modules/
-rwxr-xr-x. 1 root root  12088 Nov 12 2021 mod_access_compat.so
-rwxr-xr-x. 1 root root  12024 Nov 12 2021 mod_actions.so
-rwxr-xr-x. 1 root root  20344 Nov 12 2021 mod_alias.so
-rwxr-xr-x. 1 root root  12008 Nov 12 2021 mod_allowmethods.so
...

10. System user - apache: It runs "httpd" background processes.

herong$ sudo grep apache /etc/passwd
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin

herong$ sudo ls -l /usr/share/httpd
drwxr-xr-x. 3 root root 4096 Apr 1 2022 error
drwxr-xr-x. 3 root root 8192 Apr 1 2022 icons
drwxr-xr-x. 2 root root   24 Apr 1 2022 noindex

herong$ ps -elf | grep apache
F S UID          PID    PPID  ... CMD
5 S apache     36627   36626  ... /usr/sbin/httpd -DFOREGROUND
5 S apache     36628   36626  ... /usr/sbin/httpd -DFOREGROUND
5 S apache     36629   36626  ... /usr/sbin/httpd -DFOREGROUND
5 S apache     36630   36626  ... /usr/sbin/httpd -DFOREGROUND

Table of Contents

 About This Book

 Introduction to Linux Systems

 Process Management

 Files and Directories

Running Apache HTTP Server (httpd) on Linux Systems

 What Is Apache HTTP Server "httpd"

 Install Apache HTTP Server "httpd"

 Enable Remote Access to "httpd" Service

 Publish Home Page index.html

 "apachectl status/start/stop" Commands

Verify Apache HTTP Server "httpd" Environment

 Requirements for Supporting HTTPS on Apache

 Web Server Certificate and Required Fields

 Apache Configuration for HTTPS Protocol

 Common Issues with Apache HTTPS Support

 Listen to Non-Standard Ports with Apache

 Running Apache Tomcat on Linux Systems

 Running PHP Scripts on Linux Systems

 Running MySQL Database Server on Linux Systems

 Running Python Scripts on Linux Systems

 Conda - Environment and Package Manager

 GCC - C/C++ Compiler

 OpenJDK - Open-Source JDK

 Graphics Environments on Linux

 SquirrelMail - Webmail in PHP

 Tools and Utilities

 References

 Full Version in PDF/EPUB