Sweshi's Tutorials

Installing and configuring Apache Web Server (HTTPD) in Centos 9 Linux and below

Installing the Apache Web Server (HTTPD)

Begin by installing the httpd daemon. This is the package that has the Apache web server.

Installing the Apache(httpd) Web Server

The main configuration file for the service is the “/etc/httpd/conf/httpd.conf” file. Check that this file is present as shown in the figure with the command “ls -l /etc/httpd/conf”.

screenshot of listing the contents of etc/httpd/conf

Another important directory is the “/etc/httpd/conf.d” which contains the “userdir.conf” useful for enabling home directories to users of the server. The “welcome.conf” can also be used to add settings related to the default start page of the web server.

screenshot of etc/httpd/conf.d

Start the httpd service. Unlike other services, the httpd service can run even without configuration.

screenshot of service httpd start

Verify that the httpd service is running by running the command “service httpd status”.

screenshot of command 'service httpd status'

Check and see if the default apache page is able to open when you open an http connection to the web server. Do this by running the command “lynx http://localhost” install the lynx text based browser by running “yum install lynx -y” if the command is not found.

screenshot of 'lynx http://localhost'

The default page should be able to open as shown in the figure above. This shows that the service is running and can host web pages.

screenshot of HTTPD Apache Test page

If the test page is able to open, this means the service is running well.