Sunday 13 October 2019

How to Install Apache/httpd Web Server on CentOS 7

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 7 default repository.
This article describes How to Install Apache/HTTPD Web server in CentOS 7.

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

[root@linuxcnf ~]# yum install httpd -y
Loaded plugins: fastestmirror
  httpd.x86_64 0:2.4.6-90.el7.centos

Dependency Installed:
  apr.x86_64 0:1.4.8-5.el7           apr-util.x86_64 0:1.5.2-6.el7           httpd-tools.x86_64 0:2.4.6-90.el7.centos           mailcap.noarch 0:2.1.41-2.el7

[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 from /etc/systemd/system/ to /usr/lib/systemd/system/httpd.service.
[root@linuxcnf ~]#

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

[root@linuxcnf ~]# firewall-cmd --permanent --add-port=80/tcp
[root@linuxcnf ~]# firewall-cmd --reload
[root@linuxcnf ~]#

Step 4: Verification: Hit the server IP or host name from the any browser and it will display a CentOS 7 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. Put the website contents in the Apache root directory (/var/www/html/) default directory.

No comments:

Post a Comment