您的位置:首页 > 理论基础 > 计算机网络

编译安装httpd-2.4

2016-08-04 23:38 417 查看
编译安装httpd-2.4

编译安装步骤:

yum groupinstall "Development Tools" "Server Platform Development" -y 安装开发环境

lftp http://archive.apache.org/dist/apr/ 下载apr和apr-util
>mget apr-1.5.2.tar.bz2 apr-util-1.5.3.tar.bz2
>bye

ls
tar xf apr-1.5.2.tar.bz2

cd apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install

ls
tar xf apr-util-1.5.3.tar.bz2
cd apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

apr和apr-util就装好了。

前提:
安装开发环境,安装pcre-devel

# groupadd -r apache 创建系统组,运行apache的
# useradd -r -g apache apahce 添加一个系统用户
# yum install pcre-devel -y
# lftp http://httpd.apache.org/download.cgi 这个我下载不下来,说没有资源,但我可以手动下载,于是用xshell传输到linux上了。
# mget httpd-2.4.23.tar.bz2
# tar xf httpd-2.4.23.tar.bz2
# cd httpd-2.4.23

# ./configure --prefix=/usr/local/apache --sysconf=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
# make && make install

启动服务:
apachectl

确保80端口没有其他服务在占用,否则启动不起来,套接字是独占的。
/usr/local/apache/bin/apachectl 这个命令,不要直接使用apachectl,那是rmp包安装生成的。
也可以这样:
vim /etc/profile.d/httpd.sh
export PATH=/usr/local/apache/bin:$PATH 把这个位置放前面
保存退出

[root@web1 ~]# vim /etc/profile.d/httpd.sh
[root@web1 ~]# . /etc/profile.d/httpd.sh
[root@web1 ~]# echo $PATH
/usr/local/apache/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@web1 ~]# which apachectl
/usr/local/apache/bin/apachectl
[root@web1 ~]#

[root@web1 ~]# apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using web1.ams.com. Set the 'ServerName' directive globally to suppress this message

报错了。。。。
解决方案:
killall httpd
cd /etc/httpd24
vim httpd.conf
ServerName web1.ams.com:80 把这项启用起来,改为自己的服务器名。
保存退出,

[root@web1 ~]# apachectl restart
[root@web1 ~]# ss -tnl
80端口已经监听。

访问下自己的地址:http://192.168.1.117/
显示:it works!

本文出自 “子非鱼” 博客,请务必保留此出处http://ssippi.blog.51cto.com/11647200/1834553
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: