kution 发表于 2018-11-21 14:02:15

https服务器的配置(一)编译安装apache2.4 (httpd)

  关于https的配置无非是在apache的配置中开启mod_ssl所以在编译安装的时候我们把这个给装上去就行了
  本章我们先安装httpd
  

  一、首先我们装上编译安装的工具包
  # yum -y install gccgcc-c++
  # 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.cgiExtract$ gzip -d httpd-NN.tar.gz
$ tar xvf httpd-NN.tar
$ cd httpd-NNConfigure$ ./configure --prefix=PREFIXCompile$ makeInstall$ make installCustomize$ vi PREFIX/conf/httpd.confTest$ 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
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
  #tar -xvf apr-1.5.1.tar.gz
  
  
  #cd apr-1.5.1
  # ./configure --prefix=/usr/local/apr
  # make
  # make install
  
  三、同理apr-util也是这样安装
  #tar -xvf apr-util-1.5.4.tar.bz2
  #cd 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捆绑安装了
  #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
  Per5可选,我们暂时不安装
  
  九、安装apache
  
  次过程我们会遇到configure: WARNING:OpenSSL version is too old
  因此
  # yum install openssl-devel
  #tar xvf httpd-2.4.10.tar.gz
  #cd 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安装完成
  
  启动的话,可以
   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
  vim /etc/httpd/httpd.conf
  
  修改ServerName
  ServerName192.168.66.100我改成了我的IP
  
  为了方便在网上找一个httpd的启动脚本这个我就不在写了
  十、增加环境变量
  # vim /etc/profile.d/httpd.sh
  exportPATH=$PATH:/usr/local/apache/bin
  
  十一、关闭防火墙和selinux
  访问下你的地址可以看到
  
  It works
  
  
  




页: [1]
查看完整版本: https服务器的配置(一)编译安装apache2.4 (httpd)