我在使用 Mason 时有一个非常奇怪的行为,例如:
我有一个index.html
文件(其中包含诸如 mason 标签<% $var %> hello
)。
当我浏览到http://bla.com/index.html
编译过程中翻译的变量时。
但是当我浏览到http://bla.com/index
.
虽然没有名为index
(only index.html
) 的文件,但它仍然会加载index.html
,并且整个代码显示为纯文本/文本,包括<% ... %>
!!!
我配置错了什么?
这是我的 Apache 配置:
<VirtualHost *:80>
ServerAdmin webmaster@abc.com
ServerAlias abc.com www.abc.com
ServerName abc.com
DocumentRoot /var/www/abc.com
DirectoryIndex index.html
<Directory "/var/www/abc.com/">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
SetHandler perl-script
PerlModule HTML::Mason::ApacheHandler
PerlSetVar MasonUseObjectFiles 1
<LocationMatch "(\.html|\.txt|\.pl|\.js)$">
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
</LocationMatch>
<LocationMatch "(\.m(html|txt|pl)|dhandler|autohandler)$">
SetHandler perl-script
PerlHandler Apache::Constants::NOT_FOUND
</LocationMatch>