你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux下增加Apache的rewrite Module

[日期:2006-10-10] 来源:  作者: [字体: ]
    公司一台Linux服务器,Apache默认安装时候没有加载任何Modules,最近要用到Apache的rewrite模块,经过一夜一天的努力,终于成功了,兴奋....
现在列下几个要点:
1. Apache安装rewrite模块的时候需要DBM支持,否则无法编译,所以首先要安装一个GDBM 下载地址:ftp://ftp.gnu.org/gnu/gdbm/
安装步骤: 进入安装目录,./configure; make; make install; make install-compat; 否则无法编译出ndbm.h头文件.
2. 然后用Apache bin目录下的apxs命令安装
CODE:
/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.linux
相关资讯      
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款