Apache backend
1. Add user 'cloud'
sudo bash
adduser cloud
passwd cloud
Password : cloud
sudo echo "cloud ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
exit
Switch to user 'cloud'
su <username>
2. Install Apache
First, clean-up yum:
sudo yum clean all
As a matter of best practice we’ll update our packages:
sudo yum -y update
Installing Apache is as simple as running just one command:
sudo yum -y install httpd
Step a: Allow Apache Through the Firewall
Allow the default HTTP and HTTPS port, ports 80 and 443, through firewalld:
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp
And reload the firewall:
sudo firewall-cmd --reload
Stop firewall for Centos-6
service iptables stop
$ chkconfig iptables off
Disable SElinux
$ setenforce 0
$ getenforce
Step b: Configure Apache to Start on Boot
And then start Apache:
sudo systemctl start httpd
or
sudo service httpd start
Be sure that Apache starts at boot:
sudo systemctl enable httpd
To check the status of Apache:
sudo systemctl status httpd
To stop Apache:
sudo systemctl stop httpd
Test Apache
http://<server-ip>
$ ps -ef | grep httpd
root 16729 1 0 21:19 ? 00:00:00 /usr/sbin/httpd
apache 16731 16729 0 21:19 ? 00:00:00 /usr/sbin/httpd
apache 16732 16729 0 21:19 ? 00:00:00 /usr/sbin/httpd
apache 16733 16729 0 21:19 ? 00:00:00 /usr/sbin/httpd
apache 16734 16729 0 21:19 ? 00:00:00 /usr/sbin/httpd
apache 16735 16729 0 21:19 ? 00:00:00 /usr/sbin/httpd
apache 16736 16729 0 21:19 ? 00:00:00 /usr/sbin/httpd
apache 16737 16729 0 21:19 ? 00:00:00 /usr/sbin/httpd
apache 16738 16729 0 21:19 ? 00:00:00 /usr/sbin/httpd
cloud 16753 16567 0 21:24 pts/0 00:00:00 grep httpd
$ /usr/sbin/httpd -V | grep SERVER_CONFIG_FILE
-D SERVER_CONFIG_FILE="conf/httpd.conf"
cat /etc//httpd/conf/httpd.conf
backend files location
DocumentRoot "/var/www/html"
Add /var/www/html/whoami.html with server name and IP to recognize server response
Referece
http://www.liquidweb.com/kb/how-to-install-apache-on-centos-7/