22.2 F
Nashville
Friday, December 6, 2024

How to Install the Apache Web Server on CentOS Stream 9

Apache is available within CentOS's default software repositories, which means you can install it with yum.

How to Create Users in Linux

Linux is a multi-user system, meaning that more than one person can interact with the same system simultaneously.

How to Create Bash Aliases

This tutorial demonstrates how to use the alias command to create personalized shortcuts, which can help you save time and feel less frustrated.

How to Install the Apache Web Server on CentOS Stream 9

Pre-requisites:

A system with CentOS Stream 9 installed and running
Access to a terminal or command line
Root or sudo privileges

First, update your systems package index

dnf update -y

Install Apache

dnf install httpd -y

Once the installation is complete, enable and start the Apache service

systemctl enable httpd

systemctl start httpd

Configure the Firewall to allow http and https traffic

firewall-cmd --permanent --add-service=http

firewall-cmd --permanent --add-service=https

firewall-cmd --reload

Verify Apache Installation

systemctl status httpd

Configure Apache (Optional)

Apache’s configuration files are located in the following directory

/etc/httpd

Run the following command to see the location of the main configuration file

find ‘/etc/httpd’ -name “httpd.conf”

The main configuration file is httpd.conf and should be located in /etc/httpd/conf

Apache error logs

If you encounter any issues, check your Apache error logs located in /var/log/httpd/error_log

When it comes to restarting the Apache server, there are several reasons why you might need to do so. Some of the most common reasons are performance issues, configuration changes, and security updates.

systemctl restart httpd

To stop your web server, type:

systemctl stop httpd

Show Apache version number

httpd -v

List available Apache command line options

httpd -h

Learn about the popular Apache HTTP Web Server on the official site

https://httpd.apache.org

For information on Apache version 2.4 command line options

https://httpd.apache.org/docs/current/programs/httpd.html

Similar Articles

- A word from our sponsors -

Follow Us

Most Popular