I had also faced the similar issue in the recent past. I did lot of research on it and found the solution on it. This is the very common problem with the people getting started.
Please follow the procedure:
1. sudo vim /etc/apache2/httpd.conf
2. Insert a following line at the httpd.conf: ServerName localhost
3. Finally just restart your Apache: sudo /etc/init.d/apache2 restart
I was also NOT getting my Server Name. Inside your VirtualHost configuration that was causing this warning message, it is a generic one near a top of your httpd.conf which is by default commented out.
Change below code to
To following one:
Hope it solves your issue.