These instructions assume that you installed CentOS as documented in Base Installation of a CentOS Server.
Install apache 2 daemon (called httpd).
yum install httpd
Configure httpd to run when the system initializes.
chkconfig httpd on
To start the daemon now with out rebooting, do the following.
service httpd start
Test your server by opening port 80, and then test with a browser. (See How to Open a Port if you don't know how to open port 80.)
If there is no index file in /var/www/html, then apache serves /var/www/error/noindex.html. Create file /var/www/html/index.html with some trivial content, and then test that you can retrieve it through a browser.
If you are going to use https, then you need to install mod_ssl.
yum install mod_ssl
Open port 443, restart the https service, and test that you can retrieve the same content using https.
If you want a recent version of PHP and MySQL from the remi repo, do the following.
cd /etc/yum.repos.d/ wget http://rpms.famillecollet.com/remi-enterprise.repo yum --enablerepo remi install php mysql-server php-mysql mod_ssl
If you want a standard installation, do the following.
yum install php mysql-server php-mysql
To test that php was installed and is operational, create file /var/www/html/hi.php with the following contents.
<?php echo "hi"; ?>
Restart httpd, and then request this file though a browser, and verify that you see a page with the word hi.