I am going through the David Malan lecture on php. So I have created a simple google.html file on /public_html/google.html

which is as follows:

<!DOCTYPE html>    
    <div style = "text-align: center">
    <form action = "http://www.google.com/search" method = "get">
      <input name = "q" style = "width: 400px" type = "text">
      <input type = "submit" value = "Google Search">
      <input type = "submit" value = "I am feeling lucky">

When I tried to open http://localhost/~anupam/google.html, I got the


Not Found The requested URL /~anupam/google.html was not found on this server.

Apache/2.4.7 (Ubuntu) Server at localhost Port 80

Why am I unable to display it through localhost? I am running apache2.

  • 2
    is mod_userdir enabled in apache?
    – Jan
    Sep 12, 2014 at 21:44
  • 1
    What if you try with http://localhost/google.html ?
    – hytromo
    Sep 12, 2014 at 21:54
  • 1
    Also, if you want to go with userdir, you need to put the files in /home/YOUR_LOGIN/public_html/, not in /public_html/.
    – fkraiem
    Sep 12, 2014 at 22:21
  • 1
    Have you set up apache to use /public_html? Do you mean /public_html as you have written or is it ~/public_html? What is this lecture you're talking about? What does it suggest you do?
    – terdon
    Sep 13, 2014 at 12:29
  • when I tried toEnable Apache2 Userdir Module in Ubuntu Server,I got the following: anupam@JAZZ:~$ sudo service apache2 restart * Restarting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message [ OK ] what does this error means??
    – lazarus
    Sep 13, 2014 at 17:47

1 Answer 1


Check if mod_userdir is enabled: ls -l /etc/apache2/mods-enabled | grep userdir.

If it isn't, enable it using a2enmod userdir.
After restarting apache, files in /home/<user>/public_html are served.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.