linux下让apache支持mod_rewrite模块
来源:互联网 发布:淘宝实时交易数据 编辑:程序博客网 时间:2024/04/29 03:49
如果你的服务器apache还没有安装,那很简单,在编译apache时将 mod_rewrite模块编译进去就可以如果你的apache已经安装好了,现在只想编译出mod_rewrite.so模块,在apache中进行加载,下面我们就介绍这个方 法。
1)首次安装apache,在编译时增加–enable-rewrite选项。
如./configure –prefix=/opt/apache –enable-so –enable-mods-shared=all –enable-rewrite –enable-cache
2)增加mod_rewrite模块
# find . -name mod_rewrite.c //在apache的源码安装目录中寻找mod_rewrite.c文件
(2.2.8在目录httpd-2.2.8/modules/mappers下)
# cd PATH/to/mod_rewrite.c //进入包含mod_rewrite.c文件的目录
# /opt/apache/bin/apxs -c mod_rewrite.c //apxs应指定绝对路径,在你当前正在使用apache的bin目录里
# /opt/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la
如果没有什么错误的话,应该在你的apache的modules目录中编译出一个mod_rewrite.so文件。
编辑httpd.conf文件,确认httpd.conf中已经包含mod_rewrite.so的加载语句,如下:
LoadModule rewrite_module 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
如果重启apache出现这个错误module rewrite_module is built-in and can`t be loaded
表示模块是内建的,不用再调入,注释掉
#LoadModule rewrite_module 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
如果重启apache出现这个错误module rewrite_module is built-in and can`t be loaded
表示模块是内建的,不用再调入,注释掉
#LoadModule rewrite_module modules/mod_rewrite.so
#####################################################
检查:
[root@www httpd-2.2.8]# ../bin/apachectl configtest
Syntax OK
Syntax OK
这时,你的apache应该已经支持rewrite了。
vicos注:完成之后,记得重启服务器apache。
注意下一步,配置虚拟主机的时候要类似如下设置才可以生效:
<VirtualHost *:80>
DocumentRoot /var/www/www/www.fastu.cn/
ServerName [url]www.fastu.cn[/url]
<Directory /var/www/www/www.fastu.cn/>
Options FollowSymLinks
AllowOverride All
order allow,deny
Allow from all
</Directory>
</VirtualHost>
DocumentRoot /var/www/www/www.fastu.cn/
ServerName [url]www.fastu.cn[/url]
<Directory /var/www/www/www.fastu.cn/>
Options FollowSymLinks
AllowOverride All
order allow,deny
Allow from all
</Directory>
</VirtualHost>
如果AllowOverride设置为none的话,apache会不读取网站的.htaccess文件!
- linux下让apache支持mod_rewrite模块
- Linux下Apache安装/增加mod_rewrite模块
- Linux下Apache安装/增加mod_rewrite模块
- Linux下Apache增加mod_rewrite模块
- Linux apache 添加 mod_rewrite模块
- Linux apache 添加 mod_rewrite模块
- Linux apache 添加 mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- Apache在Windows下使用Mod_rewrite模块
- 设计模式学习过程
- 大型高并发高负载web应用系统架构-缓存架构策略
- ajax+jsp提取数据库记录并实现自动刷新页面
- 主键与索引的关系
- 【QTP 10】QTP录制时报错: unable to launch the browser 解决
- linux下让apache支持mod_rewrite模块
- iphone md5验证
- java 上传文件到本地
- 【转】Windows架设SVN服务器及在Visual Studio 2008使用ANKHSVN插件进行代码管理
- 【转】数据库优化技巧之(一):索引
- 流行的开源分布式文件系统比较
- 解决jmeter-results-report_21.xsl 的一个小不足(二)
- jsp中以弹出文件保存对话框的形式保存已有的文件(无超链接)
- 大学里,我们该何去何从~