歡迎您光臨本站 註冊首頁

Linux下Apache安裝/增加mod_rewrite模塊

←手機掃碼閱讀     火星人 @ 2014-03-12 , reply:0
  

如果你的伺服器apache還沒有安裝,那很簡單,在編譯apache時將mod_rewrite模塊編譯進去就可以,相關文檔可以在http://man.chinaunix.net/newsoft ... ew/mod/mod_rewrite. html中找到。如果你的apache已經安裝好了,現在只想編譯出mod_rewrite.so模塊,在apache中進行載入,下面我們就介紹這個方法。

 

以Fedora操作系統進行舉例:

 

1)首次安裝apache,在編譯時增加--enable-rewrite選項。

 

如./configure --prefix=/usr/local/apachel --enable-so --enable-mods-shared=all --enable-rewrite --enable-cache

 

2)增加mod_rewrite模塊

 

# find . -name mod_rewrite.c //在apache的源碼安裝目錄中尋找mod_rewrite.c文件

 

# cd PATH/to/mod_rewrite.c //進入包含mod_rewrite.c文件的目錄

# /usr/local/apache/bin/apxs -c mod_rewrite.c //apxs應指定絕對路徑,在你當前正在使用apache的bin目錄里

# /usr/local/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la

 

如果沒有什麼錯誤的話,應該在你的apache的modules目錄中編譯出一個mod_rewrite.so文件。

 

編輯httpd.conf文件,確認httpd.conf中已經包含mod_rewrite.so的載入語句,如下:

 

LoadModule rewrite_module modules/mod_rewrite.so

 

這時,你的apache應該已經支持rewrite了。

 

vicos註:完成之後,記得重啟伺服器apache。

(責任編輯:A6)



[火星人 ] Linux下Apache安裝/增加mod_rewrite模塊已經有876次圍觀

http://coctec.com/docs/net/show-post-68274.html