Question

I'm trying to install a web server on fedora 17, but it's not running any file I put on /var/www/html.

I checked the httpd.conf and it's pointing to this folder as document root. Also, if I access http://127.0.0.1 from my browser it gives me the default Apache welcome page.

Was it helpful?

Solution

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 as root, so that you have enough permission to modify the directory.
  • chmod is used to change access permissions of your files and directories.
  • -v tells chmod to be verbose and spit out information about what it is doing.
  • R stands for recursive. This will chmod the files inside html 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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top