• Linux搭建apache2.2.6 服务器的fcgi开发平台(自己总结)


    注意以下的命令操作都是在root下的,ubuntu 下用sudo command
    root@host src]# pwd
    /usr/local/src
    需要的包
    apache服务器源文件包 httpd-2.2.6.tar.gz
    apache的fastcgi模块源文件包 http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
    fastcgi开发套件工具包 http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz(C, C++, Perl, and Java)

    步骤
    ------------------------------------------------------------------------------------------
    1.安装apache服务器
    [root@host src]# tar zxvf httpd-2.2.6.tar.gz
    [root@host src]# cd httpd-2.2.6
    [root@host httpd-2.2.6]# ./configure --prefix=/usr/local/apache2.2.6
    ......(configure过程,略)
    [root@host httpd-2.2.6]# make
    ......(make过程,略)
    [root@host httpd-2.2.6]# make install
    ......(makeinstall过程,略)
    如果在make过程中出现
    ......
    include/apr.h:392:2: #error no decision has been made on APR_PATH_MAX for your platform
    ......
    先备份apr.h,然后在apr.h的
    #if defined(PATH_MAX)
    #define APR_PATH_MAX PATH_MAX
    之前加上
    #if !defined(PATH_MAX)
    #define PATH_MAX 4096
    #endif
    (Just check your PATH_MAX in limits.h to see if it's actually 4096)
    [root@host httpd-2.2.6]# pwd
    /usr/local/src/httpd-2.2.6

    apache服务器被安装到了/usr/local/apache2.2.6

    [root@host httpd-2.2.6]# cd /usr/local/apache2.2.6/

    启动apache服务器

    [root@host apache2.2.6]# bin/apachectl start
    [root@host apache2.2.6]#
    在浏览器地址栏输入http://localhost/
    出现apache默认页面。
    -------------------------------------------------------------------------------------------
    安装cgi模块:(开发cgi/fcgi应用时最好安装)

    看看/usr/local/apache2.2.6/modules下有没有mod_cgi.so模块,没有的话,我们来装下
    [root@host apache2.2.6]# cd bin
    [root@host bin]# pwd
    /usr/local/apache2.2.6/bin
    [root@host bin]# ./apxs -c -i /usr/local/src/httpd-2.2.6/modules/generators/mod_cgi.c
    (备注:./apxs -c -i /apache源文件路径/modules/generators/mod_cgi.c )
    --------------------------------------------------------------------------------------------
    安装fastcgi模块

    [root@host src]# tar zxvf mod_fastcgi-2.4.6.tar.gz
    [root@host src]# cd mod_fastcgi-2.4.6
    [root@host mod_fastcgi-2.4.6]# cp Makefile.AP2 Makefile
    [root@host mod_fastcgi-2.4.6]#
    修改Makefile中的几个目录
    top_dir 需要指定,用apache安装的路径,我们当前的是/usr/local/apache2.2.6
    APXS 与 APACHECTL使用绝对路径
    APXS      = /usr/local/apache2.2.6/bin/apxs
    APACHECTL = /usr/local/apache2.2.6/bin/apachectl
    [root@host mod_fastcgi-2.4.6]# make
    ......(make过程,略)
    [root@host mod_fastcgi-2.4.6]# make install
    ......(makeinstall过程,略)
    完成之后/usr/local/apache2.2.6/modules下应该有mod_fastcgi.so
    3.修改apache配置文件/usr/local/apache2.2.6/confhttpd.conf
    在相应的地方增加
    LoadModule fastcgi_module modules/mod_fastcgi.so
    AddHandler cgi-script .cgi .pl # 传统的CGI处理扩展名
    AddHandler fastcgi-script .fcgi .fpl # FastCGI处理的扩展名
    具体的位置见该博客页面最后,注意要找准位置,否则有可能不成功。。。。
    重启apache服务器
    [root@host apache2.2.6]# bin/apachectl restart
    [root@host apache2.2.6]#
    此时cgi程序和fastcgi程序应该可以跑起来了
    ---------------------------------------------------------------------------------------------
    <Directory "/usr/local/apache2.2.6/cgi-bin">    #CGI set  这个节点是自带的,下面接着FastCGI设置要自己设置
        AllowOverride None
        Options None
        #Options +ExecCGI
        Order allow,deny
        Allow from all
    </Directory>
    #fcgi
    #如果你不想把FastCGI程序放在cgi-bin文件夹中
    #你想放在自己建立的文件夹下,假如你在目录apache2.2.6下建立一个文件夹fcgi-bin存放fcgi文件
    #那么你就要加入下面的路径设置。当然如果你直接把fcgi文件放在cgi-bin目录中执行,那这就不需要了。
    <Directory "/usr/local/apache2.2.6/fcgi-bin">    #FastCGI set 
        AllowOverride None
        Options FollowSymLinks
        Order allow,deny
        Allow from all   
    # AddHandler fastcgi-script.fcgi.fpl
    </Directory>
    ................................
    # Virtual hosts  
    #Include conf/extra/httpd-vhosts.conf

    LoadModule fastcgi_module modules/mod_fastcgi.so   #自己添加这三行
    AddHandler cgi-script .cgi .pl # 传统的CGI处理扩展名
    AddHandler fastcgi-script .fcgi .fpl # FastCGI处理的扩展名
    ---------------------------------------------------------------------------------------------

    参考文章:

    http://blog.csdn.net/su_ocean16/archive/2010/06/07/5652232.aspx

  • 相关阅读:
    在数据库中改变对象的所有者
    初次使用WebPartManange出现数据库连接出错的问题
    js中,实现两个数字相加
    Js版日历控件
    Repeater利用PagedDataSource进行分页
    OpenDataSOurce 指定参数
    ListBox在客户端添加删除操作
    See what actually gets indexed in FAST
    开发SharePoint 2013 App 一
    Map a Crawled Property to Managed Properties (FS4SP – PowerShell)
  • 原文地址:https://www.cnblogs.com/wintergrass/p/2086407.html
Copyright © 2020-2023  润新知