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

[经验分享] https服务器的配置(一)编译安装apache2.4 (httpd)

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-1-19 08:39:16 | 显示全部楼层 |阅读模式
关于https的配置无非是在apache的配置中开启mod_ssl所以在编译安装的时候我们把这个给装上去就行了
本章我们先安装httpd

一、首先我们装上编译安装的工具包

[iyunv@CentOS6 ~]# yum -y install gccgcc-c++

[iyunv@CentOS6 ~]# yum -y install make


去apache官网下载httpd最新的版本是httpd-2.4.10

安装时我们可以去参考文档http://httpd.apache.org/docs/2.4/
官网给的安装很简单
Overview for the impatient
Download$ lynx http://httpd.apache.org/download.cgi
Extract$ gzip -d httpd-NN.tar.gz
$ tar xvf httpd-NN.tar
$ cd httpd-NN
Configure$ ./configure --prefix=PREFIX
Compile$ make
Install$ make install
Customize$ vi PREFIX/conf/httpd.conf
Test$ PREFIX/bin/apachectl -k start


NN mustbe replaced with the current version number, and PREFIX must be replaced with the filesystempath under which the server should be installed. If PREFIX is not specified, it defaults to /usr/local/apache2.

Eachsection of the compilation and installation process is described in more detailbelow, beginning with the requirements for compiling and installing Apachehttpd.

这是官网的原话
所以往下看
Requirements

The followingrequirements exist for building Apache httpd:

APR and APR-Util

Make sure youhave APR and APR-Util already installed on your system. If you don't, or preferto not use the system-provided versions, download the latest versions of bothAPR and APR-Util from Apache APR, unpack them into ./srclib/apr and ./srclib/apr-util (be surethe directory names do not have version numbers; for example, the APRdistribution must be under ./srclib/apr/) and use ./configure's --with-included-apr option. Onsome platforms, you may have to install the corresponding -dev packagesto allow httpd to build against your installed copy of APR and APR-Util.

Perl-CompatibleRegular Expressions Library (PCRE)

This library isrequired but not longer bundled with httpd. Download the source code from http://www.pcre.org,or install a Port or Package. If your build system can't find the pcre-configscript installed by the PCRE build, point to it using the --with-pcre parameter.On some platforms, you may have to install the corresponding -dev package toallow httpd to build against your installed copy of PCRE.

Disk Space

Make sure youhave at least 50 MB of temporary free disk space available. After installationthe server occupies approximately 10 MB of disk space. The actual disk spacerequirements will vary considerably based on your chosen configuration options,any third-party modules, and, of course, the size of the web site or sites thatyou have on the server.

ANSI-C Compilerand Build System

Make sure youhave an ANSI-C compiler installed. The GNU C compiler (GCC) from the Free Software Foundation(FSF) is recommended. If you don't have GCC then at least makesure your vendor's compiler is ANSI compliant. In addition, your PATH mustcontain basic build tools such as make.

Accurate timekeeping

Elements of theHTTP protocol are expressed as the time of day. So, it's time to investigatesetting some time synchronization facility on your system. Usually thentpdate or xntpd programsare used for this purpose which are based on the Network Time Protocol (NTP).See the NTPhomepage for more details about NTP software and public timeservers.

Perl 5 [OPTIONAL]

For some of thesupport scripts like apxs or dbmmanage (which are written in Perl) thePerl 5 interpreter is required (versions 5.003 or newer are sufficient). If youhave multiple Perl interpreters (for example, a systemwide install of Perl 4,and your own install of Perl 5), you are advised to use the --with-perl option(see below) to make sure the correct one is used by configure. If no Perl 5 interpreter is found bythe configure script, you will not be able touse the affected support scripts. Of course, you will still be able to buildand use Apache httpd.


因此我们一步步来,
Make sure you have APR and APR-Util already installed onyour system

二、我们安装apr apr-util
去官网下载这两个包放到/usr/local/src下面

安装apr
[iyunv@CentOS6 src]#tar -xvf apr-1.5.1.tar.gz


[iyunv@CentOS6 src]#cd apr-1.5.1
[root@CentOS6apr-1.5.1]# ./configure --prefix=/usr/local/apr
[root@CentOS6apr-1.5.1]# make
[root@CentOS6apr-1.5.1]# make install

三、同理apr-util也是这样安装
[iyunv@CentOS6 src]#tar -xvf apr-util-1.5.4.tar.bz2
[iyunv@CentOS6 src]#cd apr-util-1.5.4
[iyunv@CentOS6 apr-util-1.5.4]#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

四、Perl-Compatible Regular Expressions Library (PCRE)


This library is required but not longer bundled withhttpd
这个库必须安装因为他不再和httpd捆绑安装了
[iyunv@CentOS6 src]#yum-y install pcre-devel

五、Disk Space

Make sure you have at least 50 MB of temporary free diskspace available.

确保你至少有50M可用空间

六、ANSI-C Compiler and Build System

安装基本的库上面已经安装过了

七、Accurate time keeping

保证系统时间正确

八、Perl5 [OPTIONAL]

Per5可选,我们暂时不安装

九、安装apache

次过程我们会遇到configure: WARNING:OpenSSL version is too old
因此
[iyunv@CentOS6 src]# yum install openssl-devel
[iyunv@CentOS6 src]#tar xvf httpd-2.4.10.tar.gz
[iyunv@CentOS6 src]#cd httpd-2.4.10

[iyunv@CentOS6 httpd-2.4.10]./configure--prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewrite--enable-ssl  --enable-cgi --enable-cgid--enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

好了htppd安装完成

启动的话,可以
[iyunv@CentOS6 httpd-2.4.10] cd /usr/local/apache/bin

AH00557: httpd:apr_sockaddr_info_get() failed for CentOS6.4.hby.com
AH00558: httpd:Could not reliably determine the server's fully qualified domain name, using127.0.0.1. Set the 'ServerName' directive globally
[iyunv@CentOS6 httpd-2.4.10]vim /etc/httpd/httpd.conf

修改ServerName
ServerName192.168.66.100我改成了我的IP

为了方便在网上找一个httpd的启动脚本这个我就不在写了
十、增加环境变量
[root@CentOS6init.d]# vim /etc/profile.d/httpd.sh
exportPATH=$PATH:/usr/local/apache/bin

十一、关闭防火墙和selinux
访问下你的地址可以看到

It works



运维网声明 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-40978-1-1.html 上篇帖子: 源码安装httpd2.4 下篇帖子: https服务器的配置(二)配置apache虚拟主机
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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