Sunday 16 August 2020

How to Install Apache/httpd Web Server on CentOS 8




Apache is most popular and open source web server to server html, php and others. It released by apache foundation under GNU license. The apache binary is available in CentOS 8 default repository.

This article describes How to Install Apache/HTTPD Web server in CentOS8.

Step 1: Install Apache packages: Run the following command to install apache/httpd package:

[root@linuxcnf ~]# dnf install httpd
Last metadata expiration check: 0:09:53 ago on Sun 16 Aug 2020 10:54:41 AM EDT.
Dependencies resolved.
…………………………..………
Installed:
  httpd-2.4.37-21.module_el8.2.0+382+15b0afa8.x86_64                               
…………………..………………

Complete!
[root@linuxcnf ~]#

Step 2: Start and Enable httpd server: Run the following commands to Start Apache web Server and configure for auto start at OS boot up:

[root@linuxcnf ~]# systemctl restart httpd
[root@linuxcnf ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service /usr/lib/systemd/system/httpd.service.
[root@linuxcnf ~]#

Step 3: Firewall Configuration: Allow the port 80/443 from the firewall to access Apache Web Server from any remote system:

[root@linuxcnf ~]# firewall-cmd --zone=public --permanent --add-service=http
success
[root@linuxcnf ~]# firewall-cmd --zone=public --permanent --add-service=https
success
[root@linuxcnf ~]# firewall-cmd --reload
success
[root@linuxcnf ~]#

 Step 4: Verification: Hit the server ip or host name from the any browser and it will display a CentOS 8 default page, since there no web content in the Web server root directory and the apache will display the default page.


Done!!! Apache Web Server Installed successfully.

No comments:

Post a Comment