Apache已安装之后添加模块

进入源码安装目录中:

# cd httpd-2.2.22
# /usr/local/apache/bin/apxs -c mod_rewrite.c
# /usr/local/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la

如果没有错误,将会在/usr/local/apache2/modules目录下有mod_rewrite.so文件。
编辑httpd.conf文件,确认httpd.conf中已经包含mod_rewrite.so的加载语句,如下:

LoadModule rewrite_module modules/mod_rewrite.so

重启Apache!
可能出现的问题:

httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Can't locate API module structure 'mod_rewrite_module' in file /usr/local/apache2/modules/mod_rewrite.so: /usr/local/apache2/modules/mod_rewrite.so: undefined symbol: mod_rewrite_module

修改 httpd.conf,将

LoadModule mod_rewrite_module modules/mod_rewrite.so

改为

LoadModule mod_rewrite modules/mod_rewrite.so
Syntax error on line 329 of /usr/local/apache2/conf/httpd.conf:
Can't loacte API module staructure 'mod_rewrite_module' in file /usr/local/apache2/modules/mod_rewrite.so:/usr/local/apache2/lib/libapr-0.so.0:undefined symbol:mod_rewrite_module

修改http.conf
原来:httpd.conf里面写的mod_rewrite_module
改成 rewrite_module
如果出现:

httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: module rewrite_module is built-in and can't be loaded

表示模块是内建的,不用再调入,注释掉

#LoadModule rewrite_module modules/mod_rewrite.so

发表评论

电子邮件地址不会被公开。 必填项已用*标注


*

Top