日期:2014-05-16  浏览次数:20732 次

apache安装详解
下面是linux下安装apache的完整代码,系统是redhat5.5
下载httpd-2.2.6.tar.bz2  把httpd-2.2.6.tar.bz2放到/soft 下
[root@localhost ~]#cd /soft
[root@localhost soft]#tar jxvf httpd-2.2.6.tar.bz2    //解压apache的压缩包
[root@localhost soft]#cd httpd-2.2.6     //定位到httpd-2.2.6 文件夹下
[root@localhost httpd-2.2.6]#ls     //查看显示httpd-2.2.6 文件夹下内容
[root@localhost httpd-2.2.6]#./configure --help | more    //查看安装apache配置参数
[root@localhost httpd-2.2.6]#./configure  --prefix=/usr/local/apache  --enable-so    //  配置apache路径
[root@localhost httpd-2.2.6]#make     //编译apache
[root@localhost httpd-2.2.6]#make install    //安装apache
[root@localhost httpd-2.2.6]#cd /usr/local/apache   //进入apache的目录     
[root@localhost apache]#  cd conf/
[root@localhost conf]#cp -a httpd.conf httpd.conf-     //备份apache配置文件
[root@localhost conf]#chkconfig  --list httpd     //查看httpd服务是否已存在
[root@localhost conf]#chkconfig httpd off    //关闭系统自带了httpd的服务,如果存在httpd服务   
[root@localhost conf]#service httpd status    //查看自带httpd服务状态
[root@localhost conf]#/usr/local/apache/bin/apachectl -k start    //linux启动apache命令              
[root@localhost conf]#netstat -an | grep :80    //查看linux80端口是否开启
[root@localhost conf]#ps -aux | grep httpd     //linux下查看apache进程
[root@localhost conf]#cd ../..
[root@localhost local]#cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache //拷贝apache启动脚本