close

一直以來都管理 Windows 上的機器居多,在 Windows 要把模組打開,通常就是到 Apache 目錄下的 httpd.conf,把註解掉的模組檔 (*.so) 前面的註解拿掉,譬如說,遇到以下的錯誤訊息,是無法載入網址重寫 (URL rewrite) 的模組的錯誤:

Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

在 Windows 時,只要到 Apache\conf\httpd.conf,把以下這行前面註解的井字號 (#) 拿掉,然後存檔重啟 Apache 就可以了:

LoadModule rewrite_module modules/mod_rewrite.so

但是最近有一台新的機器,作業系統是 Linux 的 SUSE,我試著要 vi /etc/apache2/sysconfig.d/loadmodule.conf,但是發現每次重啟 Apache 後,這個 config 檔的內容都會被還原到我修改之前的狀態。

後來才發現應該要下指令(必須要有系統權限,沒有的話,最前面要加上 sudo):

a2enmod rewrite

下完以後再重啟 Apache,就可以了,這樣的 loadmodule.conf 內容才會正確。


另外我還需要載入 SSL 模組,沒載入的話會有以下錯誤訊息:

Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration

載入的指令是:

a2enmod ssl


另外,因為有 SSL,所以沒辦法直接用 apache restart 來重啟,要記得先停掉 Apache (stop) 再下啟動為 SSL (startssl):

service apache2 startssl


打完收工~

arrow
arrow
    文章標籤
    apache linux suse
    全站熱搜

    小攻城師 發表在 痞客邦 留言(0) 人氣()