Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

源码编译安装系列-APACHE

[复制链接]
platinum 发表于 2004-10-22 16:36:07 | 显示全部楼层 |阅读模式
作者:白金 网名:platinum(chinaunix) 超超白金(白金论坛)  
欢迎转载,转载请保留上述信息  
===========================================================================


安装apache

tar  -xzvf  http*.tar.gz   
cd  httpd*

配置apache 支持动态module 加载

./configure --prefix=/usr/local/apache2 --mandir=/usr/share/man --enable-so --enable-module=rewrite --enable-track-vars --enable-deflate --enable-cache --enable-mem-cache --enable-disk-cache --enable-rewrite=shared --enable-status=shared --enable-file-cache --enable-cgid --enable-expires=share

要和tomcat集成module=so必有;其他一些参数:--enable-cgi 支持CGI;--enable-track-vars 为启动cookie的get/post等追踪功能

make  
make install

vi /usr/local/apache2/conf/httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so

启动服务
/usr/local/apache2/bin/apachectl start

用浏览器浏览,如果能显示页面,证明就OK了

在服务里添加httpd服务
vi /etc/rc.d/init.d/httpd

  1. #!/bin/bash
  2. #
  3. # Startup script for the Apache Web Server
  4. #
  5. # chkconfig: - 85 15
  6. # description: Apache is a World Wide Web server.  It is used to serve \
  7. #              HTML files and CGI.
  8. # processname: httpd
  9. # pidfile: /var/run/httpd.pid
  10. # config: /etc/httpd/conf/httpd.conf

  11. # Source function library.
  12. . /etc/rc.d/init.d/functions

  13. if [ -f /etc/sysconfig/httpd ]; then
  14.         . /etc/sysconfig/httpd
  15. fi

  16. # This will prevent initlog from swallowing up a pass-phrase prompt if
  17. # mod_ssl needs a pass-phrase from the user.
  18. INITLOG_ARGS=""

  19. # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
  20. # with the thread-based "worker" MPM; BE WARNED that some modules may not
  21. # work correctly with a thread-based MPM; notably PHP will refuse to start.

  22. # Path to the apachectl script, server binary, and short-form for messages.
  23. apachectl=/usr/local/apache2/bin/apachectl
  24. httpd=${HTTPD-/usr/local/apache2/bin/httpd}
  25. prog=httpd
  26. RETVAL=0

  27. # check for 1.3 configuration
  28. check13 () {
  29.         CONFFILE=/usr/local/apache2/conf/httpd.conf
  30.         GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
  31.         GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
  32.         GONE="${GONE}AccessConfig|ResourceConfig)"
  33.         if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
  34.                 echo
  35.                 echo 1>&2 " Apache 1.3 configuration directives found"
  36.                 echo 1>&2 " please read /usr/share/doc/httpd-2.0.46/migration.html"
  37.                 failure "Apache 1.3 config directives test"
  38.                 echo
  39.                 exit 1
  40.         fi
  41. }

  42. # The semantics of these two functions differ from the way apachectl does
  43. # things -- attempting to start while running is a failure, and shutdown
  44. # when not running is also a failure.  So we just do it the way init scripts
  45. # are expected to behave here.
  46. start() {
  47.         echo -n $"Starting $prog: "
  48.         check13 || exit 1
  49.         daemon $httpd $OPTIONS
  50.         RETVAL=$?
  51.         echo
  52.         [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
  53.         return $RETVAL
  54. }
  55. stop() {
  56.         echo -n $"Stopping $prog: "
  57.         killproc $httpd
  58.         RETVAL=$?
  59.         echo
  60.         [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
  61. }
  62. reload() {
  63.         echo -n $"Reloading $prog: "
  64.         check13 || exit 1
  65.         killproc $httpd -HUP
  66.         RETVAL=$?
  67.         echo
  68. }

  69. # See how we were called.
  70. case "$1" in
  71.   start)
  72.         start
  73.         ;;
  74.   stop)
  75.         stop
  76.         ;;
  77.   status)
  78.         status $httpd
  79.         RETVAL=$?
  80.         ;;
  81.   restart)
  82.         stop
  83.         start
  84.         ;;
  85.   condrestart)
  86.         if [ -f /var/run/httpd.pid ] ; then
  87.                 stop
  88.                 start
  89.         fi
  90.         ;;
  91.   reload)
  92.         reload
  93.         ;;
  94.   graceful|help|configtest|fullstatus)
  95.         $apachectl $@
  96.         RETVAL=$?
  97.         ;;
  98.   *)
  99.         echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
  100.         exit 1
  101. esac

  102. exit $RETVAL
复制代码

chmod a+x /etc/rc.d/init.d/httpd
chkconfig --add httpd

OK,之后用ntsysv就可以看到有httpd服务了,开机可以自动运行
eyoyo 发表于 2004-10-23 03:09:03 | 显示全部楼层
安装出错了.
回复

使用道具 举报

 楼主| platinum 发表于 2004-10-23 08:17:19 | 显示全部楼层
到哪里出错?你是怎么装的?
回复

使用道具 举报

eyoyo 发表于 2004-10-23 09:42:01 | 显示全部楼层
--enable-so
上面说,没有这个东西哦.偶糊涂了.
我重做一次,截图给你看,偶刚学linux.....
回复

使用道具 举报

eyoyo 发表于 2004-10-23 09:53:25 | 显示全部楼层
[root@RealPower apache_1.3.31]# ./configure --prefix=/usr/local/apache2 --mandir=/usr/share/man --enable-so --enable-module=rewrite --enable-cgi --enable-track-vars --enable-deflate --enable-gzip --enable-cache --enable-mem-cache --enable-disk-cache --enable-rewite=shared --enable-forward --enable-status=shared --disable-status --enable-file-cache --with-mpm=prefork --enable-cgid --enable-expires=share
Configuring for Apache, Version 1.3.31
+ using installation path layout: Apache (config.layout)
configure:Error: invalid option '--enable-so'
回复

使用道具 举报

eyoyo 发表于 2004-10-23 09:54:34 | 显示全部楼层
[root@RealPower apache_1.3.31]# make
make: *** No targets specified and no makefile found.  Stop.
回复

使用道具 举报

 楼主| platinum 发表于 2004-10-23 22:59:52 | 显示全部楼层
忘记说了,对不起
这个是APACHE2的编译方法,APACHE1.3.X我已经不去用了,感觉还是APACHE2好
从编译参数里你也应该可以看到的
回复

使用道具 举报

eyoyo 发表于 2004-10-23 23:46:14 | 显示全部楼层
不好意思,可能是我的电脑问题。不知道为什么,我换来换去编译的时候都是会有这样的结果。能请问一下为什么吗?
[root@BBgirl httpd-2.0.49]#  ./configure --prefix=/usr/local/apache2 --mandir=/usr/share/man --enable-so --enable-module=rewrite --enable-cgi --enable-track-vars --enable-deflate --enable-gzip --enable-cache --enable-mem-cache --enable-disk-cache --enable-rewrite=shared --enable-forward --enable-status=shared --disable-status --enable-file-cache --with-mpm=prefork --enable-cgid --enable-expires=share
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu

Configuring Apache Portable Runtime library ...

checking for APR... reconfig
configuring package in srclib/apr now
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
Configuring APR library
Platform: i686-pc-linux-gnu
checking for working mkdir -p... yes
APR Version: 0.9.5
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
configure failed for srclib/apr
[root@BBgirl httpd-2.0.49]# make
make: *** No targets specified and no makefile found.  Stop.
[root@BBgirl httpd-2.0.49]#
回复

使用道具 举报

eyoyo 发表于 2004-10-23 23:54:55 | 显示全部楼层
弄了一天都糊涂了,原来我忘记装gcc啦,谢谢你的文章,太好啦。
回复

使用道具 举报

 楼主| platinum 发表于 2004-10-24 01:22:26 | 显示全部楼层
呵呵,是啊,从你的提示来看
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

就是没有安装编译器造成的

怎么样,现在OK了吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-12-23 11:54 , Processed in 0.029274 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表