Install Apache on CentOS 9 Stream - Step by step guide ?
CentosApache , 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.
Table of contents [Show]
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 . ]
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.