404 Not Found尝试访问本地LAMP服务器上的localhost时出错

sla*_*dau 4 php apache ubuntu lamp http-status-code-404

我正在运行Ubuntu.我的Apache2默认文件如下所示:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

我在/ var/www /中有一个名为Index.php的文件

<?
phpinfo();
?>
Run Code Online (Sandbox Code Playgroud)

当我在浏览器中访问http:// localhost /时,我收到404 Not Found错误:

在此服务器上找不到请求的URL /.位于localhost端口80的Apache/2.2.16(Ubuntu)服务器

我究竟做错了什么?这在我第一次设置LAMP时实际上有效,但它现在不能正常工作.

And*_*son 5

看看/ etc/apache2/sites-enabled.看起来我升级到10.10已经擦除了该目录中的符号链接.尝试将符号链接默认为/ etc/apache2/sites-available/default

sudo ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/default
Run Code Online (Sandbox Code Playgroud)