How to Install Apache on CentOS 7

1) To check your hostname run

# hostname
# hostname -f

2) Update your system:

# sudo yum update

3) Install and Configure Apache

# sudo yum install httpd

4) Create the directories referenced above

# sudo mkdir -p /var/www/html/{public_html, logs}

5) Enable Apache to start at boot, and restart the service for the above changes to take effect

# sudo systemctl enable httpd.service
# sudo systemctl restart httpd.service

6) Configure firewalld to Allow Web TrafficPermalink.
CentOS 7’s built-in firewall is set to block web traffic by default. Run the following commands to allow web traffic:

# sudo firewall-cmd add-service=http permanent && sudo firewall-cmd add-service=https permanent
# sudo systemctl restart firewalld

7) Check Apache server status

# sudo service httpd status

8) Go to your domain or ip. but if not show "Testing 123" you can comand

# sudo iptables -F