Cart 0
No products in the cart.

Install Apache on CentOS 9 Stream - Step by step guide ?

Install Apache on CentOS 9 Stream - Step by step guide ?

Apache , also known as Apache HTTP server is a free, open-source, and cross-platform HTTP server, including powerful features, and can be extended by a wide variety of modules. It is part of the LAMP stack (Linux, Apache, MySQL, PHP) that powers much of the internet.

Here at Fixwebnode , as part of our Server Management Services , we regularly help our Customers to perform related Apache queries.

In this context, we shall look into how to install Apache on CentOS 9 Stream.

Main Features of Apache Web Server includes:

  • Handling of static files.
  • Loadable dynamic modules.
  • Auto-indexing.
  • .htaccess.
  • Compatible with IPv6.
  • Supports HTTP/2.
  • FTP connections.
  • Gzip compression and decompression.
  • Bandwidth throttling.
  • Perl, PHP, Lua scripts.
  • Load balancing.
  • Session tracking.
  • URL rewriting.
  • Geolocation based on IP address.

 

Steps to Install Apache on CentOS 9 Stream

1. Perform System Update    

To begin, make sure your system is up-to-date with the below command:

$ sudo dnf update
	
	
	
	
	
	
	
	
	
	
	
	
	
	

 

2. Install the Apache on the system    

By default, Apache is available on the CentOS 9 Stream base repository. Now we run the following command to install Apache HTTP server to your system:

$ sudo dnf install httpd httpd-tools
	
	
	
	
	
	
	
	
	
	
	
	
	
	

Once the installation is complete, now enable Apache (to start automatically upon system boot), start the webserver, and verify the status using the commands below:

$ sudo systemctl start httpd
	
	
	
	
	
	
	
	
	
	
	
	
$ sudo systemctl enable httpd
$ sudo systemctl status httpd

To verify the Apache version, use the following command to confirm:

$ httpd -v
	
	
	
	
	
	
	
	
	
	
	
	
	
	

 

3. Configure Firewall    

If your server is protected by the firewall and you haven't opened the HTTP and HTTPS ports. Enable them with the following commands below:

$ sudo firewall-cmd --permanent --zone=public --add-service=http 
	
	
	
	
	
	
	
	
	
	
	
	
$ sudo firewall-cmd --permanent --zone=public --add-service=https
$ sudo firewall-cmd --reload

 

4 Confirm Apache Installation    

Once successfully installed, open your favorite web browser and enter the URL http://your-IP-address  and you will see the default Apache HTTP server welcome page .

 

About Apache Configuration File's Structure ?

You should know the location of the configuration files and the Apache root directory in case you need to modify the configuration:

  • All Apache configuration files are located in the /etc/httpd directory.
  • The main Apache configuration file is /etc/httpd/conf/httpd.conf.
  • Configuration files ending with .conf located in the /etc/httpd/conf.d the directory is included in the main Apache configuration file.
  • Configuration files that are responsible for loading various Apache modules are located in the /etc/httpd/conf.modules.d directory.
  • Apache vhost files must end with .conf and be stored in /etc/httpd/conf.d directory. You can have as many vhosts as you need. Creating a separate configuration file (vhost) for each domain makes the server easier to maintain.

 

[Need help in fixing Apache Configuration issues ?  We can help you . ]

 



CONCLUSION

This article covers how to install the Apache webserver on CentOS 9 Stream. In fact, Apache is a popular Linux-based web server application. It is part of the LAMP stack (Linux, Apache, MySQL, PHP) that powers much of the internet World.

How to install Apache Web Server on CentOS 8 ?

1. Update Software Repository   

Open a terminal window, and update the repository package lists by entering the following:

$ sudo yum update
	
	
	
	
	
	
	
	
	
	
	
	
	
	

2. Install Apache   

Now you can install Apache with the command:

$ sudo yum –y install httpd
	
	
	
	
	
	
	
	
	
	
	
	
	
	

Note: "httpd" is the name for the Apache service in CentOS. The –y option automatically answers yes to the confirmation prompt.

3. Start and Manage Apache Web Server   

Apache is a service that runs in the background.

Start the Apache service by entering the following:

$ sudo systemctl start httpd
	
	
	
	
	
	
	
	
	
	
	
	
	
	

To configure Apache to run on startup:

$ sudo systemctl enable httpd
	
	
	
	
	
	
	
	
	
	
	
	
	
	

To check the status of the Apache service:

$ sudo systemctl status httpd
	
	
	
	
	
	
	
	
	
	
	
	
	
	

To reload Apache (reloads configuration files to apply changes):

$ sudo systemctl reload httpd
	
	
	
	
	
	
	
	
	
	
	
	
	
	

To restart the entire Apache service:

$ sudo systemctl restart httpd
	
	
	
	
	
	
	
	
	
	
	
	
	
	

To stop Apache:

$ sudo systemctl stop httpd
	
	
	
	
	
	
	
	
	
	
	
	
	
	

To disable Apache at system startup:

$ sudo systemctl disable httpd
	
	
	
	
	
	
	
	
	
	
	
	
	
	

 

In this guide, you will learn how to install Apache on CentOS 9 Stream.

 


icon

Sign up to Newsletter

...and receive a free support ticket.