2010-12-30 06:22

美化 Apache autoindex

因為原始的 auto Index 的頁面實在太醜了
也許五年前看起來還很新潮,但現在已經過時了
所以我自己做的一個 Apache 美化套件

檔案下載:fancy.zip

2010-12-30 06:03

Apache Expires模組(mod_expires) 設定參數

  1. # @version $Id: .htaccess 130 2010-09-29 10:03:56Z jax.hu $ 
  2.  
  3. #Options -FollowSymLinks -Indexes #TODO 開發時關閉 
  4.  
  5. # 關閉 Apache Rewrite 模組 
  6. <IfModule mod_rewrite.c> 
  7.    RewriteEngine off 
  8. </IfModule> 
  9.  
  10.  
  11. # 啟用 Apache mod_expires 模組,來管理 browser 端的 cache 時間 
  12. <IfModule mod_expires.c> 
  13.    ExpiresActive On 
  14.    ExpiresDefault A0  
  15.  
  16.    # ExpiresDefault "<base> [plus] {<num> <type>}*" 
  17.    # base:[ access | modification ] 
  18.    # type:[ years | months | weeks | days | hours | minutes | seconds ] 
  19.  
  20.    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> 
  21.        ExpiresDefault "access plus 1 years" 
  22.    </FilesMatch> 
  23.  
  24.    <FilesMatch "\.(jpg|jpeg|png|gif|swf|txt|xml|js|css)$"> 
  25.        ExpiresDefault "access plus 7 days" 
  26.    </FilesMatch> 
  27. </IfModule> 
  28.  
  29. # 關閉 Apache 對檔案的實體標籤 
  30. FileETag none 

參考來源:
mod_expires - Apache HTTP Server:
mod_expires - Apache 2.2 中文版参考手册:
Apache2 載入 Expires 的模組(mod_expires) 與 設定
ezDIY.org / 使用mod_expires模組來加速網頁瀏覽
2010-12-30 05:54

Apache 壓縮模組(mod_deflate) 設定參數

  1. # @version $Id: .htaccess 130 2010-09-29 10:03:56Z jax.hu $ 
  2.  
  3. RewriteEngine on 
  4. RewriteRule ^.*$ index.php 
  5.  
  6. php_flag magic_quotes_gpc off 
  7. php_flag register_globals on 
  8. php_flag output_buffering on 
  9.  
  10.  
  11. # 啟用 Apache 壓縮模組 
  12. <IfModule mod_deflate.c> 
  13.    AddOutputFilterByType DEFLATE text/css  
  14.    AddOutputFilterByType DEFLATE text/javascript  
  15.    AddOutputFilterByType DEFLATE text/js 
  16.    AddOutputFilterByType DEFLATE text/xml 
  17.    AddOutputFilterByType DEFLATE text/html 
  18.    AddOutputFilterByType DEFLATE text/plain 
  19.    AddOutputFilterByType DEFLATE image/svg+xml 
  20.    AddOutputFilterByType DEFLATE application/xhtml+xml 
  21.    AddOutputFilterByType DEFLATE application/xml 
  22.    AddOutputFilterByType DEFLATE application/rss+xml 
  23.    AddOutputFilterByType DEFLATE application/atom_xml 
  24.    AddOutputFilterByType DEFLATE application/x-javascript 
  25.    AddOutputFilterByType DEFLATE application/x-httpd-php 
  26.    AddOutputFilterByType DEFLATE application/x-httpd-fastphp 
  27.    AddOutputFilterByType DEFLATE application/x-httpd-eruby 
  28.    AddOutputFilterByType DEFLATE application/postscript 
  29.    AddOutputFilter DEFLATE html htm xml css js svg 
  30.  
  31.    # properly handle requests coming from behind proxies 
  32.    <IfModule mod_headers.c> 
  33.        Header append Vary User-Agent 
  34.    </IfModule> 
  35. </IfModule> 

參考來源:
mod_deflate - Apache HTTP Server:
mod_deflate - Apache 2.2 中文版参考手册
[Apache] 壓縮你的網頁 – mod_deflate/mod_gzip、ob_gzhandler、zlib | 阿駕零零壹 © 學習筆記:
2010-12-24 01:02

[轉載] Google 氣球

轉載自:robhawkes
實在是太酷了,想儲存起來
2010-12-08 13:45

SVN connection settings for Eclipse

建立 SVN 連結



將現有專案 commit 到 SVN 上



開啟 SVN keywords PS:這個功能是由 client 處理的
選取專案 -> 右鍵 -> 內容



在專案下建立以下內容,然後 commit 到 SVN 上
  1. <?php 
  2. // SVN-keywords-test.php 
  3. /* 
  4. $Id$ 
  5. $Date$ 
  6. $Revision$ 
  7. $Author$ 
  8. $HeadURL$ 
  9. */ 

參考來源:
Subversion中的关键字替换
关键字替换
如何结合使用 Subversion 和 Eclipse
在eclipse下的SVN插件配置忽略文件和文件夹
2010-12-08 11:42

[Ubuntu] setup SVN base Apache note

# 安裝 Apache & SVN
apt-get install apache2 apache2.2-common apache2-utils apache2-doc libapache2-svn subversion

# 建立 Repositorys 的目錄
mkdir /var/lib/svn

# 建立三個 Repository
svnadmin create /var/lib/svn/repo1
svnadmin create /var/lib/svn/repo2
svnadmin create /var/lib/svn/repo3


# 變更 Repositorys 的權限給 Apache
chown -R www-data:www-data /var/lib/svn

# 啟用 Apache 中的 dav_svn
a2enmod dav_svn

# 設定 SVN 使用者帳號
htpasswd -c /etc/apache2/dav_svn.passwd user1
htpasswd /etc/apache2/dav_svn.passwd user2
htpasswd /etc/apache2/dav_svn.passwd user3


# 編輯 SVN 配置檔
vim /etc/apache2/mods-available/dav_svn.conf
  1. <Location /svn> 
  2.  DAV svn 
  3.  SVNParentPath /var/lib/svn 
  4.  AuthType Basic 
  5.  AuthName "Subversion Repository" 
  6.  AuthUserFile /etc/apache2/dav_svn.passwd 
  7.  AuthzSVNAccessFile /etc/apache2/dav_svn.authz 
  8.  <LimitExcept GET PROPFIND OPTIONS REPORT> 
  9.    Require valid-user 
  10.  </LimitExcept> 
  11. </Location> 

# 編輯 SVN 資源權限
vim /etc/apache2/dav_svn.authz
  1. # 設定使用者群組 
  2. [groups] 
  3. group1 = user1,user2 
  4. group2 = user1,user3 
  5.  
  6.  
  7. # 設定全域皆可讀取 
  8. [/] 
  9. * = r 
  10.  
  11. # 指定 repo1 只有 group1 可以寫入 
  12. [repo1:/] 
  13. @group1 = rw 
  14.  
  15. # 指定 repo1 中 blog 這個目錄只有 uesr2 可以寫入 
  16. [repo1:/blog/] 
  17. uesr2 = rw 
  18.  
  19.  
  20. # 指定 repo2 只有 group2 可以寫入 
  21. [repo2:/] 
  22. @group2 = rw 
  23.  
  24. # 指定 repo3 只有 user1 可以寫入 
  25. [repo3:/] 
  26. user1 = rw 

# 重新啟動 Apache
/etc/init.d/apache2 restart


參考來源:
Ubuntu - 安裝 SVN (Subversion Server)
Subversion用户,权限管理