Using virtual hosts on Apache allows you to host multiple websites on one server. In order for virtual hosts to function correctly you will need to insure that you have DNS set up correctly for your sites. If you are following this tutorial for test purposes you can reference this video on how to manually set DNS on a Centos Server:
If you need to know how to install apache on CentOs you can reference this video:
The commands that you need to follow this video are:
cd /var/www/html/
sudo mkdir site1
sudo mkdir site2
sudo chown apavhe:apache -R site1
sudo chown apavhe:apache -R site2
sudo vi site1/index.html
sudo vi site2/index.html
cd /ete/httpd/
sudo mkdir sites-available
sudo mkdir sites-enabled
sudo vi /etc/httpd/conf/httpd.conf
Add this line to the end of your file:
IncludeOptional sites-enabled/*.conf
cd sites-avaiable
sudo vi site1.com.conf
<VirtualHost *:80>
ServerName www.site1.com
ServerAlias site1.com
DocumentRoot /var/www/html/site1/
ErrorLog /var/www/html/site1/error.log
CustomLog /var/www/html/site1/requests.log combined
</VirtualHost>
sudo cp site1.com.conf site2.com.conf
sudo vi site2.com.conf
<VirtualHost *:80>
ServerName www.site2.com
ServerAlias site2.com
DocumentRoot /var/www/html/site2/
ErrorLog /var/www/html/site2/error.log
CustomLog /var/www/html/site2/requests.log combined
</VirtualHost>
sudo ln -s /etc/httpd/sites-available/site1.com.conf /etc/httpd/sites-enabled/site1.com.conf
sudo ln -s /etc/httpd/sites-available/site2.com.conf /etc/httpd/sites-enabled/site2.com.conf
sudo service httpd restart
Disable selinux
sudo setenfoce 0