我正在运行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时实际上有效,但它现在不能正常工作 .
5 回答
看看/ etc / apache2 / sites-enabled . 看起来我升级到10.10已经擦除了该目录中的符号链接 . 尝试将符号链接默认为/ etc / apache2 / sites-available / default
检查错误日志(tail /var/log/apache2/error.log)以找出Apache尝试查找的确切路径 .
我的问题完全一样 .
以下为我工作:
如 Andreas Jansson 所述,符号链接默认为:
并重新启动apache2:
然后它的工作原理:
使用url localhost / info.php . 文件info.php必须包含
<?php phpinfo(); ?>
你是否安装并启用了PHP模块?因为,通常情况下,它会在服务器签名中提及,但您的't. That would also explain why the server doesn'不会认为
index.php
是/
的意思 .尝试