For example, if your main domain name for the given server is certaindomainname.com

1. Switch to root user

sudo su

2. Open hosts file on the server

nano /etc/hosts

and make sure you have this in it:

127.0.0.1 localhost.localdomain localhost certaindomainname.com
::1 localhost.localdomain localhost certaindomainname.com

Save the file.

3. Open Apache configuration file

nano /etc/httpd/conf/httpd.conf

And include the hostname here:

ServerName certaindomainname.com

A popular way of doing it also is to have a subdomain assigned as a hostname.

4. Restart Apache

service httpd restart