我最近刚开始学apache,用的是公司的测试服务器,之前服务器上面已经有人装过apache了,并配置了svn,所以apache的配置不敢肯定完全是原始默认配置。
环境:ubuntu 8.04,apache 2.2.8,apache的安装方式是apt-get install apache2
现象:虚拟主机配置的默认目录是/var/www,如果访问的是/var/www下的非icons文件夹里的内容,比如http://localhost/a/1.jpg,则完全正常,显示的就是/var/www/a/1.jpg,但如果访问的是/var/www下的icons文件夹里的内容,比如http://localhost/icons/1.jpg,则会去查找访问/usr/share/apache2/icons/1.jpg,即没有去访问/var/www下的icons文件夹,日志会提示:"[error] [client 192.168.1.100] File does not exist: /usr/share/apache2/icons/1.jpg"。百思不得其解,难道icons文件夹是个名字特殊的文件夹吗?
如需要,则虚拟主机的配置片段如下:
NameVirtualHost *
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 /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
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>