Linux下增加Apache的rewrite Module(轉)
Linux下增加Apache的rewrite Module(轉)[@more@]公司一臺Linux伺服器,Apache預設安裝時候沒有載入任何Modules,最近要用到Apache的rewrite模組,經過一夜一天的努力,終於成功了,興奮....
現在列下幾個要點:
1. Apache安裝rewrite模組的時候需要DBM支援,否則無法編譯,所以首先要安裝一個GDBM 下載地址:
安裝步驟: 進入安裝目錄,./configure; make; make install; make install-compat; 否則無法編譯出ndbm.h標頭檔案.
2. 然後用Apache bin目錄下的apxs命令安裝
/var/apache/bin/apxs -c mod_rewrite.c {
gcc -DLINUX=22 -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -fpic -DSHARED_MODULE -I/var/apache/include -c mod_rewrite.c
gcc -shared -o mod_rewrite.so mod_rewrite.o -lgdbm
}
/var/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.so
然後在http.conf配置檔案里加上:LoadModule rewrite_module libexec/mod_rewrite.so
接下來用/usr/local/apache/bin/apachectl
stop停止apache,然後用再start,千萬注意,在這裡不能用restart或者graceful引數來重新啟動apache,必須先停止,然後再開始,或者是reboot機器,否則rewrite將不起作用。
-------------------------------------------------------------------------------------------------------------
I tried to include in my Apache Web server's configuration the mod_rewrite module, but when I restarted the server, I received an error:
Cannot load /usr/local/apache/libexec/mod_rewrite.so into server:
/usr/local/apache/libexec/mod_rewrite.so: undefined symbol: dbm_fetch
The problem, as it turns out, is that mod_rewrite.so is compiled incorrectly. It should be linked with a dbm library but it isn't.
If you have an up-to-date set of Apache source files, you can easily solve this problem by manually rerunning the last compilation step of this module, using the correct options. When you execute make mod_rewrite.so in the appropriate directory, it performs this final step:
gcc -shared -o mod_rewrite.so mod_rewrite.lo
Rerun gcc, this time adding a reference to the GNU gdbm library:
gcc -shared -o mod_rewrite.so mod_rewrite.lo -lgdbm
Next, copy the newly created mod_rewrite.so over to /usr/local/apache/libexec or wherever your Apache module files are located.
In my case, this was all that was needed to solve the problem. Your mileage may vary.
現在列下幾個要點:
1. Apache安裝rewrite模組的時候需要DBM支援,否則無法編譯,所以首先要安裝一個GDBM 下載地址:
安裝步驟: 進入安裝目錄,./configure; make; make install; make install-compat; 否則無法編譯出ndbm.h標頭檔案.
2. 然後用Apache bin目錄下的apxs命令安裝
/var/apache/bin/apxs -c mod_rewrite.c {
gcc -DLINUX=22 -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -fpic -DSHARED_MODULE -I/var/apache/include -c mod_rewrite.c
gcc -shared -o mod_rewrite.so mod_rewrite.o -lgdbm
}
/var/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.so
然後在http.conf配置檔案里加上:LoadModule rewrite_module libexec/mod_rewrite.so
接下來用/usr/local/apache/bin/apachectl
stop停止apache,然後用再start,千萬注意,在這裡不能用restart或者graceful引數來重新啟動apache,必須先停止,然後再開始,或者是reboot機器,否則rewrite將不起作用。
-------------------------------------------------------------------------------------------------------------
I tried to include in my Apache Web server's configuration the mod_rewrite module, but when I restarted the server, I received an error:
Cannot load /usr/local/apache/libexec/mod_rewrite.so into server:
/usr/local/apache/libexec/mod_rewrite.so: undefined symbol: dbm_fetch
The problem, as it turns out, is that mod_rewrite.so is compiled incorrectly. It should be linked with a dbm library but it isn't.
If you have an up-to-date set of Apache source files, you can easily solve this problem by manually rerunning the last compilation step of this module, using the correct options. When you execute make mod_rewrite.so in the appropriate directory, it performs this final step:
gcc -shared -o mod_rewrite.so mod_rewrite.lo
Rerun gcc, this time adding a reference to the GNU gdbm library:
gcc -shared -o mod_rewrite.so mod_rewrite.lo -lgdbm
Next, copy the newly created mod_rewrite.so over to /usr/local/apache/libexec or wherever your Apache module files are located.
In my case, this was all that was needed to solve the problem. Your mileage may vary.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10617731/viewspace-961267/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Apache在Windows下使用Mod_rewrite模組ApacheWindows
- Apache Rewrite詳解Apache
- Apache 重寫規則的常見應用 (rewrite)(轉)Apache
- (轉) linux下增加swap分割槽Linux
- 開啟apache的mod_rewrite功能Apache
- nginx學習-ngx_http_rewrite_module模組NginxHTTP
- Apache的rewrite規則詳細介紹Apache
- Linux下Apache與Tomcat整合的簡單方法(轉)LinuxApacheTomcat
- apache的rewrite規則無法載入問題Apache
- Apache之Rewrite和RewriteRule規則梳理以及http強轉https的配置總結ApacheHTTP
- 利用apache的mod_rewrite做URL規則重寫Apache
- Linux下安裝ApacheLinuxApache
- apache url rewrite及正規表示式筆記Apache筆記
- linux下增加swap分割槽Linux
- HT之LINUX下增加磁碟Linux
- UNIX下的PHP環境配置,+apache (轉)PHPApache
- Linux下為ASM增加空間LinuxASM
- 在RedHat Linux 7.3下安裝Apache + PHP + Mysql + JDK + Resin (轉)RedhatLinuxApachePHPMySqlJDK
- Nginx 實現 Rewrite 跳轉Nginx
- Linux上配置Apache,支援中文名稱檔案下載的方法(轉)LinuxApache
- Linux下Apache遮蔽user-agentLinuxApache
- linux 下增加硬碟簡單介紹Linux硬碟
- linux下配置APACHE2.0.50+PHP5.0.3+MYSQL4.0.20+GD庫(轉)LinuxApachePHPMySql
- Apache模組開發/用C語言擴充套件apache(3:一個非常簡單的apache module)ApacheC語言套件
- Linux module(Linux 模組)Linux
- mod_rewrite模組詳解(轉)
- ubuntu15 安裝nginx 報錯:the HTTP rewrite module requires the PCRE library.UbuntuNginxHTTPUI
- apache2.2支援worker,rewrite模組,支援執行緒Apache執行緒
- Linux下apache 與weblogic結合LinuxApacheWeb
- rewrite實現目錄之間的跳轉
- rewrite規則中引數多於9個的處理方式 apache nginxApacheNginx
- Linux 下 Apache 與 Tomcat 整合的簡單方法LinuxApacheTomcat
- linux下的ldd(轉)Linux
- Apache模組開發/用C語言擴充套件apache(4:一個生產環境使用的apache module)ApacheC語言套件
- VMware下LINUX的虛擬機器增加磁碟空間Linux虛擬機
- Linux安裝:mysql+apache+php(轉)LinuxMySqlApachePHP
- Ubuntu Linux:Apache安裝設定(轉)UbuntuLinuxApache
- Linux系統線上增加多個ip(轉)Linux