If you are using apache,
First Locate httpd.conf file.
To which directory DocumentRoot is pointing to in /etc/httpd/conf/httpd.conf file
If DocumentRoot is pointing to /var/www/html then you need to keep your code under this directory.
Also make sure apache is listening to port 80 in /etc/httpd/conf/httpd.conf file