不去在乎结果,热情地付出过,就好了.

apache单独编译mod_rewrite Error: Command failed with rc=65536解决办法

a

(基于debian系统)

不久前博客迁移到现在的服务器上来,

刚开始只有首页可以访问,其他页面都显示found on this server,

主题自带404页面不起作用,很不友好.

将wordpress的固定链接改为默认的xxx/?xxx=xxx的模式才可以访问其他页面,

404页还是无效.

上网查的,由于apache没有开启rewrite模块,

打开apache的配置文件,没有找到关于载入rewrite模块的代码,

目录文件也没有相关的文件,得出结论:

这台主机当初编译apache是没有编译rewrite模块…

这台为所属单位贡献收入过百万的主机居然没有rewrite…

好吧,我自己编译…

find -name mod_rewrite.c

找到源代码的位置,例如:

/usr/local/src/httpd-2.2.13/modules/mappers

然后使用 Apache 安装好的 apxs 命令编译即可

/usr/local/apache2/bin/apxs -i -a -c ./mod_rewrite.c

但是我在编译时出现了如下错误:

Warning! dlname not found in /usr/local/apache2/modules/mod_rewrite.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache2/modules/mod_rewrite.so
chmod: cannot access `/usr/local/apache2/modules/mod_rewrite.so’: No such fr directory
apxs:Error: Command failed with rc=65536

上网查询得知是libtool的版本不同所致,解决方法如下:

vim /usr/local/apache2/build/libtool

按照如下修改:

build_libtool_libs=no
build_libtool_libs=yes

fast_install=needless
fast_install=yes

dlopen_support=unknown
dlopen_support=yes

dlopen_self=unknown
dlopen_self=yes

dlopen_self_static=unknown
dlopen_self_static=yes

host_alias=
host_alias=i686-pc-linux-gnu

保存后重新编译,并重启apache,

这是应该默认已经载入rewrite模块了.

Over.

打赏

2 comments

18 − 17 =

    • 这台主机上的apache不是apt装的是编译安装的,
      位于/usr/local/apache2,
      在/usr/local/apache2/modules中并没有rewrite相关文件,
      而a2enmod的作用在于建立模块文件的连接文件至/mods-enabled,
      这里应该是用不起的吧.

不去在乎结果,热情地付出过,就好了.
某一天,你所坚持的,和承担过的一切,会有回应。它们并非失去踪迹,只是需要时间抵达。这和星光落入眼睛里,是一样的道理。

近期文章

近期评论