- 论坛徽章:
- 0
|
(請原諒 Crosspost 了一下)
從 Apache 1.3.XX 轉用 Apache 2.2.6 之後發現不能以 AddDefaultCharset 使自動 indexing 的網頁以 UTF-8 顯示. 只以 ISO 亂碼 顯示.
是否有所欠缺 ? 煩請指教. 謝謝!
1. 相關 httpd.conf 如下:
LoadModule mime_module libexec/apache22/mod_mime.so
LoadModule negotiation_module libexec/apache22/mod_negotiation.so
LoadModule userdir_module libexec/apache22/mod_userdir.so
LoadModule vhost_alias_module libexec/apache22/mod_vhost_alias.so
Include etc/apache22/extra/httpd-languages.conf
Include etc/apache22/extra/httpd-userdir.conf
Include etc/apache22/extra/httpd-vhosts.conf
2. 相關 httpd-vhosts.conf 如下:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@mydomain.com
DocumentRoot /home3/myname/public_html/movie
ServerName drama.mydomain.com
<Directory "/home3/mydomain/public_html/movie/">
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
AddDefaultCharset UTF-8
</Directory>
ErrorLog /var/log/apache/drama.mydomain-error.log
CustomLog /var/log/apache/drama.mydomain-access.log common
</VirtualHost>
3. 相關 httpd-languages.conf 如下:
DefaultLanguage zh-TW
AddLanguage zh-TW .zh-tw
AddLanguage en .en
LanguagePriority zh-TW en
ForceLanguagePriority Prefer Fallback
AddCharset UTF-8 .utf8
4. 相關 httpd-userdir.conf 如下:
<Directory /home3/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes FollowSymLinks SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
發現 extra 內的文檔欠缺 <IfModule ...</IfModule> 等語法.
如 httpd-languages.conf 內沒有了:
<IfModule mod_mime.c>, <IfModule mod_negotiation.c>
如 httpd-userdir.conf 內沒有了:
<IfModule mod_userdir.c>
但 apache 跑起來沒有投訴.
嘗試將有關模塊 (mod_negotiation.so, mod_mime.so) 取走後重載 apache 即發現語法錯誤. 證明 extra 內預設文檔不需要 <IfModule ...</IfModule> ??
嘗試以 .htaccess 指定 Charset 不行.
煩請指教. 謝謝! |
|