我有一個非常奇怪的現象,而使用梅森,例如:梅森和Apache的配置,加載文件不存在
我有一個index.html
文件(包含像<% $var %> hello
石匠標籤)。
當我瀏覽到http://bla.com/index.html
時,變量在編譯期間被轉換。
但是當我瀏覽到http://bla.com/index
時有一種奇怪的行爲。
儘管有(僅index.html
)呼籲index
沒有文件仍然加載index.html
和整個代碼顯示爲純/文本包括<% ... %>
!
我配置錯了什麼?
這是我的Apache配置:
<VirtualHost *:80>
ServerAdmin [email protected]
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>
嘿,謝謝你的回答,雖然我不想將每個文件添加到REGEX(這是一個安全漏洞,一旦我忘記添加不同的文件) – 2011-04-18 14:45:41
平原/文本的mime不打擾我,因爲它不是假設加載它在第一個地方... Web服務器像添加它自己的「.html」在後臺或其他東西,因爲它發生在目錄中的每個文件... – 2011-04-18 14:46:43
嗯,我覺得我太耐心了當我跳槍並提供了上述答案時。 (我很想投我自己的答案...)。爲了理解你的Web服務器的行爲:如果你調用一個文件foo.html,那麼當你提供URL「http:/」時,這個文件是否也會被逐字檢索(用mime類型的'plain/text') /bla.com/foo「? – IllvilJa 2011-04-18 18:59:29