You are currently viewing Apache 安裝後增加 Module 的方法

Apache 安裝後增加 Module 的方法

要為 Apache 加載 mod_rewrite 模組,如果 Apache 並未安裝,可以在編譯時加上 –enable-rewrite 便可以,但如果 Apache 已經安裝好,而又不想重新編譯 Apache 的話,可以用以下方法:

  1. 在apache的 source code 中尋找 mod_rewrite.c 檔案
find ./ -name mod_rewrite.c
  1. 進入 mod_rewrite.c 的目錄並用 apxs 編譯 mod_rewrite.c
cd PATH/to/mod_rewrite.c
/usr/local/apache/bin/apxs -c mod_rewrite.c
/usr/local/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la
  1. 編譯好 mod_rewrite.c 後,便開啟 httpd.conf 加入以下內容:
LoadModule rewrite_module modules/mod_rewrite.so

Beck Yeh

熱愛學習於 Linux 與 程式設計 在網站中分享各式各樣學習到的新知識

發佈留言

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料