我正在运行 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>
我在/var/www/中有一个名为 Index.php 的文件
<?
phpinfo();
?>
当我访问 http://localhost/ 时在我的浏览器中,我收到 404 Not Found 错误:
在此服务器上找不到请求的 URL/。 Apache/2.2.16 (Ubuntu) 服务器在 localhost 端口 80
我做错了什么?这在我第一次设置 LAMP 时确实有效,但现在不起作用。
最佳答案
查看/etc/apache2/sites-enabled。似乎我升级到 10.10 已经从该目录中删除了符号链接(symbolic link)。尝试将默认符号链接(symbolic link)到/etc/apache2/sites-available/default
sudo ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/default
关于php - 尝试访问本地 LAMP 服务器上的 localhost 时出现 404 Not Found 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4060034/