免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1505 | 回复: 0
打印 上一主题 下一主题

Linux下增加Apache的rewrite Module [复制链接]

论坛徽章:
2
丑牛
日期:2013-09-29 09:47:222015七夕节徽章
日期:2015-08-21 11:06:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-19 18:56 |只看该作者 |倒序浏览

公司一台
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命令安装
    /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.
转自:http://www.phpchina.cn/bbs/viewthread.php?tid=96


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/4206/showart_694644.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP