我正在尝试在Mint linux上设置apache虚拟主机。它有点工作,但有些图像不可用。例如,即使图像存在,http://test.local/icons/world.png也会返回404。当我检查日志时它表示它正在 /usr/share/apache2/icons/world.png 中寻找图像,即使我将我的DocumentRoot设置为/var/www/test.local/public_html
这就是我这样做的方式。将/ etc / apache2 / sites-available / default复制到test.local并编辑如下:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName test.local
DocumentRoot /var/www/test.local/public_html
<Directory /var/www/test.local/public_html/>
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
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
</VirtualHost>
然后我编辑/ etc / hosts并在其中包含 127.0.0.1 test.local 。运行 a2ensite test.local 并重新启动apache。
我尝试做的是 /var/www/test.local/public_html 中的地图文件夹到 http://test.local 我有什么遗漏或者更简单的方法。
另外,项目的根目录或图标目录中没有.htaccess文件。
答案 0 :(得分:1)
决议:)
这是我第二次在SO上回答我自己的问题。我实际上正在研究2天,并在发布后几个小时找到答案。
答案是这是默认的Apache别名
Alias /icons/ "/usr/share/apache2/icons/"
即使我在 apache2.conf 或 conf.d 目录中找不到它,它看起来好像在 / etc / apache2 /中我的Mint发行版下的mods-available / alias.conf (我猜所有的Debian发行版都有类似的路径)。我需要做的就是注释掉这个别名并且它有效。