Installing httpd on centos 7

  1. Install Apache:
    1. First, clean-up yum:
      yum clean all
    2. As a matter of best practice we’ll update our packages:
      yum -y update
    3. Installing Apache is as simple as running just one command:
      yum -y install httpd
  2. Allow Apache Through the Firewall

Allow the default HTTP and HTTPS port, ports 80 and 443, through firewalld:

firewall-cmd --permanent --add-port=80/tcp 
firewall-cmd --permanent --add-port=443/tcp

And reload the firewall:

firewall-cmd --reload

 

Configure Apache to Start on Boot

    1. And then start Apache:
systemctl start httpd
    1. Be sure that Apache starts at boot:
systemctl enable httpd

Other useful commands for Apache

    1. To check the status of Apache:
      systemctl status httpd
    2. To stop Apache:
      systemctl stop httpd