404 Not Found Error when trying to access localhost on local LAMP server

前端 未结 5 2094
暗喜
暗喜 2021-01-06 10:33

I\'m running Ubuntu. My Apache2 default file looks like this:


        ServerAdmin webmaster@localhost

        DocumentRoot /var/www         


        
相关标签:
5条回答
  • 2021-01-06 10:58

    Exactly the same problem with me.

    Following worked for me :

    As Andreas Jansson mentioned, symlink default to:

    sudo ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/default
    

    and restarted apache2:

    sudo /etc/init.d/apache2 restart
    

    and then it works:

    http://localhost/
    
    0 讨论(0)
  • 2021-01-06 11:02

    Do you have the PHP module installed and enabled? Because, normally, it would mention that in the server signature, but yours doesn't. That would also explain why the server doesn't recognize that index.php is what you mean by /.

    Try

    sudo a2enmod php5
    
    0 讨论(0)
  • 2021-01-06 11:09

    Have a look in /etc/apache2/sites-enabled. It seems like my upgrade to 10.10 has wiped the symlinks from that directory. Try symlinking default to /etc/apache2/sites-available/default

    sudo ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/default
    
    0 讨论(0)
  • 2021-01-06 11:12

    Check out error log (tail /var/log/apache2/error.log) in order to find out exact path that Apache tries to find.

    0 讨论(0)
  • 2021-01-06 11:23

    Use the url localhost/info.php. File info.php must contain <?php phpinfo(); ?>

    0 讨论(0)
提交回复
热议问题