If you are using apache,
First Locate httpd.conf file.
To which directory DocumentRoot is pointing to in /etc/httpd/conf/httpd.conf file
Code:
ServerAdmin root@localhost
DocumentRoot /var/www/html
ServerName localhost
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