【发布时间】:2011-08-07 20:37:38
【问题描述】:
我在使用 Mason 时有一个非常奇怪的行为,例如:
我有一个 index.html 文件(其中包含像 <% $var %> hello 这样的石匠标签)。
当我浏览到 http://bla.com/index.html 时,变量在编译期间被翻译。
但是当我浏览到http://bla.com/index 时出现了一个奇怪的行为。
虽然没有名为index(只有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>
【问题讨论】:
标签: perl apache configuration mason