How to Install Apache Web Server on CentOS 8 (Step by Step). In this post, we introduce Apacheweb server, its advantages then show you how to install Apache web server on CentOS 8.
First of all, the Apache Software Foundation develops and maintains Apache, an open source web server software that has been in existence for over 20 years. All in all, Apache powers millions of websites and serves billions of users every day as the most widely used web server software in the world. The Apache Software Foundation, a non profit organization, provides support and resources for open source software projects.
Allows developers to customize the web server to meet their specific needs, and extend it with a variety of modules that provide additional functionality.
2. High configurability
Offers a wide range of options that can be set in its configuration file, allowing administrators to fine tune the web server to optimize its performance and security.
3. Ability to handle a large number of concurrent connections
Makes it well suited for high traffic websites and applications, as it handles a large number of requests without becoming overloaded.
4. Support for server side scripting languages
Provides integration with languages such as PHP, allowing developers to create dynamic websites and applications.
5. Database integration
Moreover, it allows developers to connect to and manage databases, enabling the creation of database driven websites and applications.
6. SSL/TLS encryption
Provides secure communication between the web server and clients, protecting sensitive data from being intercepted during transmission.
7. Wide operating system support
Runs on a variety of operating systems, including Linux, Unix, and Windows, making it a flexible and versatile option for web servers.
Freely available to anyone who wants to use it, and developers are able to modify and distribute the source code as they see fit.
2. Reliability and stability
With long track record of performance and security and is supported by a large community of users and developers who contribute to its development and support.
3. Easy to set up and manage
Widely supported by hosting providers and is straightforward to set up and manage, making it a convenient option for web servers.
4. Flexibility and versatility
Runs on a variety of operating systems, including Linux, Unix, and Windows, allowing it to be used in a range of environments.
5. Customization
The modular design of Apache allows developers to customize the web server to meet their specific needs, and extend it with a variety of modules that provide additional functionality.
6. Widely adopted
Most widely used web server software in the world, powering millions of websites and serving billions of users every day.
7. Strong community support
Equally, Apache Software Foundation, provides support and resources for open source software projects, ensuring that Apache has a strong community of users and developers who contribute to its development and support.
Up next with How to Install Apache Web Server on CentOS 8 is navigate to installations steps.
Before starting, it is always a good idea to update all system packages to the latest version. Update all the packages by running the following command.
dnf update -y
Once all the packages are updated, you can proceed to set up a firewall rule for Apache.
Step 2 - Setup Firewall
Firewalld is a default firewall tool that comes preinstalled on CentOS 8 operating system. Moreover, you will need to add a firewall rule for Apache service to access it from the external system.
Please run the following command to add firewall rules for HTTP and HTTPS service.
Evidently, the Apache web server package is included in the CentOS default repo. In order to install it, run the following command.
dnf install httpd -y
After installing the Apache web server package, you verify the Apache package information using the following command.
rpm -qi httpd
You should see the Apache package information in the following output.
Name : httpd
Version : 2.4.37
Release : 47.module_el8.6.0+1111+ce6f4ceb.1
Architecture: x86_64
Install Date: Saturday 24 December 2022 02:09:15 PM UTC
Group : System Environment/Daemons
Size : 4499649
License : ASL 2.0
Signature : RSA/SHA256, Wednesday 06 April 2022 03:16:12 PM UTC, Key ID 05b555b38483c65d
Source RPM : httpd-2.4.37-47.module_el8.6.0+1111+ce6f4ceb.1.src.rpm
Build Date : Wednesday 06 April 2022 02:55:33 PM UTC
Build Host : x86-01.mbox.centos.org
Relocations : (not relocatable)
Packager : CentOS Buildsys
Vendor : CentOS
URL : https://httpd.apache.org/
Summary : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.
Step 4 - Manage Apache Service
In CentOS, the Apache web service is managed by systemd. You can start and stop it easily via systemctl command. To start the Apache service, run the following command.
systemctl start httpd
If you want to verify the Apache service status, run the following command.
systemctl status httpd
You should see the following output.
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2022-12-24 14:09:30 UTC; 4s ago
Docs: man:httpd.service(8)
Main PID: 26737 (httpd)
Status: "Started, listening on: port 80"
Tasks: 213 (limit: 5941)
Memory: 25.5M
CGroup: /system.slice/httpd.service
├─26737 /usr/sbin/httpd -DFOREGROUND
├─26738 /usr/sbin/httpd -DFOREGROUND
├─26739 /usr/sbin/httpd -DFOREGROUND
├─26740 /usr/sbin/httpd -DFOREGROUND
└─26741 /usr/sbin/httpd -DFOREGROUND
Dec 24 14:09:30 centos8 systemd[1]: Starting The Apache HTTP Server...
Here, to enable the Apache service, run the following command.
systemctl enable httpd
To stop the Apache service by running the following command:
systemctl stop httpd
By default, Apache listens on port 80. You can verify it using the following command.
Now, open your web browser and access the Apache test page using the URL http://your-server-ip. You should see the Apache test page on the following screen.
All in all, Virtual hosting is an Apache web server feature that allows you to host multiple websites on a single server. In this section, we host a site named app.example.com using the virtual hosting feature.
First of all, please create your website directory using the following command.
mkdir /var/www/html/app.example.com
After that, set proper permission and ownership with the following command.
Finally, your website is hosted on the Apache web server. Verify it using the URL http://app.example.com. You should see your website page on the following screen.
Thank you for reading How to Install Apache Web Server on CentOS 8 (Step by Step). We shall conclude this article blog.
How to Install Apache Web Server on CentOS 8 (Step by Step) Conclusion
In this step by step guide, we explained how to install the Apacheweb server on CentOS 8. Additionally, we also showed you how to create a virtual host in Apache. Indeed, Apache is a powerful and reliable open source web server that is widely used by individuals and organizations around the world. Its modular design, configurability, and ability to handle a large number of concurrent connections make it an ideal choice for a variety of applications. Its open source nature and strong community support ensure that it will continue to be a popular choice for web servers in the future.
Would you like to read more Apache content, please navigate to our blog over here.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.