Please note that simply putting some files inside the /var/www/html/
directory should make Apache display them. Here are some possible pointers that you might have missed.
Specify your DocumentRoot
correctly in your httpd.conf
. This is usually located at /etc/httpd/conf/httpd.conf
.
DocumentRoot "/var/www/html"
And make sure Apache allows people to access it, with something like
<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
AllowOverride None
Options Indexes FollowSymLinks
Require all granted
</Directory>
Next, ensure that the permissions for your directories are correct, and allow people to read
them.
sudo chmod -vR 755 /var/www/html
A quick breakup of the above command:
sudo
at the beginning tells the shell to execute the following command asroot
, so that you have enough permission to modify the directory.chmod
is used to change access permissions of your files and directories.-v
tellschmod
to beverbose
and spit out information about what it is doing.R
stands forrecursive
. This willchmod
the files insidehtml
and sub-directories, if any.
Additional read: Wikipedia entry on chmod
In case you are accessing your local server using a hostname, make sure that you have defined it in /etc/hosts
. For example, if you want lappy
as your hostname, then your /etc/hosts
will look something like
127.0.0.1 lappy