apache 模块的编写

来源:互联网 发布:家具生产软件 编辑:程序博客网 时间:2024/05/16 15:48

step to step:

 

安装好apache之后。

 

[1] apxs -g -n aaa
                    Creating [DIR]  aaa
                    Creating [FILE] aaa/Makefile
                    Creating [FILE] aaa/modules.mk
                    Creating [FILE] aaa/mod_aaa.c
                    Creating [FILE] aaa/.deps
[2] cd aaa
[3] apxs -c mod_aaa.c
                    //编译
[4] apxs -i mod_aaa.la
[5] vi /etc/httpd/conf/httpd.conf
                   add bellow words to the file:
    LoadModule aaa_module modules/mod_aaa.so
    <Location /aaa>
    setHandler aaa
    </Location>
[6] apachctl restart
[7] ie browser,   http://localhost/aaa

 

 

 

在mod_aaa.c中,aaa_register_hooks(apr_pool_t *p)注册apache模块。

                                static int aaa_handler(request_rec *r)中添加你要实现的代码。

 

 

可以参考:

http://yangzb.javaeye.com/blog/561357
http://andrew913.javaeye.com/blog/398648
apache图片操作
http://www.itqun.net/content-detail/105257.html