设为首页 收藏本站
查看: 2257|回复: 0

[经验分享] httpd 2.4.12 安装配置

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-3-31 08:24:58 | 显示全部楼层 |阅读模式
编译apache 之前查看官网的安装说明

http://httpd.apache.org/docs/2.4/install.htmlapache 安装说明

下载组件wgethttp://mirrors.hust.edu.cn/apache/apr/apr-1.5.1.tar.gz

        wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.gz

        wget ftp://ftp.csx.cam.ac.uk/pub/soft ... re/pcre-8.35.tar.gz

需要编译安装组件 aprapr-util pcre ,验证一下下载的组件包是否正常

       https://apr.apache.org/docs/apr/1.5/  查看官网安装说明

2.4.1 编译apache

http://httpd.apache.org/docs/2.4/en/programs/configure.html  编译参数选项说明

[iyunv@web1_lamp ~]# cd /soft/tool/

[iyunv@web1_lamp ~]#tarapr-1.5.1.tar.gz -C /usr/local/src/

[iyunv@web1_lamp ~]#tar zxfapr-util-1.5.4.tar.gz -C /usr/local/src/

[iyunv@web1_lamp ~]#cd/usr/local/src/apr-1.5.1/

[iyunv@web1_lamp apr-1.5.1]# ./configure --prefix=/usr/local/apr

备注:有时候这样的编译的apache也会报错apr的错误,解决方法:./configure --prefix=/usr/local/apr-httpd  

编译的时候可以使用./configure –help

rm: cannot remove `libtoolT': Nosuch file or directory

config.status: executing default commands

如果不是error 或者警告之类的错误提示 不需要理会他就行了

或者参考去修改configure 文件 将这行注释掉

   cfgfile="${ofile}T"

    trap"$RM \"$cfgfile\"; exit 1" 1 2 15

   # "$RM \"$cfgfile\"注释掉就可以了,可以去apache官网查找帮助

https://bz.apache.org/bugzilla/show_bug.cgi?id=51726

[root@web1_lampapr-1.5.1]#  make && make install

[iyunv@web1_lamp apr-1.5.1]# cd/usr/local/src/apr-util-1.5.4/

[iyunv@web1_lamp apr-util-1.5.4]#

[iyunv@web1_lamp apr-util-1.5.4]#

./configure\

--prefix=/usr/local/apr-util\

--with-apr=/usr/local/apr

备注:即使这样编译安装了也会报错,解决方法:--prefix=/usr/local/apr-util-httpd

apr-util参考官网或者使用./configure–help 去添加一些参数

[iyunv@web1_lamp apr-util-1.5.4]# make

[iyunv@web1_lamp apr-util-1.5.4]# make install

[root@web1_lampapr-util-1.5.4]# cd /soft/tool/

[iyunv@web1_lamp tool]# tarzxf pcre-8.36.tar.gz -C /usr/local/src/

[iyunv@web1_lamp tool]# cd/usr/local/src/pcre-8.36

[iyunv@web1_lamp pcre-8.35]#./configure --prefix=/usr/local/pcre

[iyunv@web1_lamp pcre-8.35]# make&& make install

[iyunv@web1_lamp pcre-8.35]#cd /usr/local/src/httpd-2.4.12/  

[root@web1_lamphttpd-2.4.12]#

./configure\

--prefix=/usr/local/apache2 \

--with-apr=/usr/local/apr \

--with-apr-util=/usr/local/apr-util \

--with-pcre=/usr/local/pcre \

--enable-modules=mall \

--enable-rewrite  \

--enable-mpms-shared=all \

--with-mpm=event \

--enable-v4-mapped \

--enable-so

[root@web1_lamphttpd-2.4.12]# make && make install

参数说明

静态编译所有模块,但保留动态加载选项--enable-so,之后还是可以在配置文件中动态加载自己编译的模块。

--sysconfdir=/etc/httpd   指定apache的配置文件在/etc/httpd

如果不指定apahce 的配置文件,默认在/usr/local/apache/conf

[root@web1_lamphttpd-2.4.12]# make && make install

[iyunv@web1_lamp httpd-2.4.12]#/usr/local/apache2/bin/apachectl -t测试apache

AH00558:httpd: Could not reliably determine the server's fully qualified domain name,using 20.0.0.10. Set the 'ServerName' directive globally to suppress thismessage

SyntaxOK

关于源码启动解决

故障原因是由于源码conf/httpd.conf中关于hostname设置和/etc/sysconfig/network的hostname不一致导致的

默认的HOSTNAME=localhost.localdomain

1.[iyunv@web1_lamp rc.d]# vim /etc/http/httpd.conf   

ServerName localhost:80   è设置为本机

[iyunv@web1_lamp httpd-2.4.12]# more  /usr/local/apache2/bin/apachectl   查看apache的启动脚本

[iyunv@web1_lamp httpd-2.4.12]# /usr/local/apache2/bin/apachectl-k start

Apche 启动之后需要查看apche状态,需要去查apache的端口或者进程,默认的端口号为80

[iyunv@web1_lamp httpd-2.4.12]# netstat -anp| grep 80

tcp        0      0 :::80                       :::*                        LISTEN      1282/httpd         

unix  3      [ ]         STREAM     CONNECTED     10580 1249/master   

[root@web1_lamphttpd-2.4.12]# ps axu|grep httpd

root       2383 0.0  1.7 244612  8668 ?       Ss   18:16   0:00 /usr/local/apache2/bin/httpd -k start

daemon     2384 0.0  1.3 586736  6616 ?       Sl   18:16   0:00 /usr/local/apache2/bin/httpd -k start

daemon     2385 0.0  1.3 586736  6620 ?       Sl   18:16   0:00 /usr/local/apache2/bin/httpd -k start

daemon     2386 0.0  1.3 586736  6624 ?       Sl   18:16   0:00 /usr/local/apache2/bin/httpd -k start

root       2469 0.0  0.1 103244   864 pts/0   S+   18:16   0:00 grep httpd

启动之后可以在客户端去测试,注意必须使用hosts 解析

测试apache安装ok

[iyunv@web1_lamp httpd-2.4.12]# /usr/local/app/apache2/bin/apachectl -k start  启动apache

[iyunv@web1_lamp conf]#/usr/local/apache2/bin/apachectl  graceful  

重启不断开链接/ apachectl生产常用 apachectl  –t 检查配置文件语法关闭就是-k  stop

2.4.2 Apache 配置

[iyunv@web1_lamp ~]# echo"/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local è添加到开机加载文件中,设置apache为开机启动

[iyunv@web1_lamp httpd-2.4.12]# cp/usr/local/apache2/bin/apachectl  /etc/init.d/httpd

[iyunv@web1_lamp httpd-2.4.12]# chmod 755 /etc/init.d/httpd

[iyunv@web1_lamp rc.d]# chkconfig --add httpdè这样添加会报错

service httpd does not support chkconfig   没有这个服务

[iyunv@web1_lamp httpd-2.4.12]# chkconfig--add httpd

service httpd does not support chkconfig

[iyunv@web1_lamp httpd-2.4.12]# more /etc/init.d/httpd   查看一下httpd的启动脚本

[iyunv@web1_lamp httpd-2.4.12]# vim/etc/init.d/httpd    编辑httpd 启动脚本

[iyunv@web1_lamp httpd-2.4.12]# # tail -2/etc/init.d/httpd  需要将注释的下面两行添加到/etc/init.d/httpd

#chkconfig: 2345 8515

#description:Activates/Deactivates Apache Web Server

[iyunv@web1_lamp httpd-2.4.12]# chkconfig--add httpd

[iyunv@web1_lamp httpd-2.4.12]# chkconfig--list httpd

httpd           0:off   1:off  2:on    3:on    4:on   5:on    6:off

[root@web1_lamprc.d]# chkconfig httpd on 添加为开机自启动




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-52346-1-1.html 上篇帖子: 配置Apache实现url转发 下篇帖子: 编译安装apache并指定工作模式为work
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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