系统环境CentOS6.5
一、编译安装Apache
关闭selinux和防火墙
1、解决依赖关系
[[email protected] ~]# yum install gcc gcc-c++ openssl openssl-devel
编译安装apr(The mission of the Apache Portable Runtime (APR) project is to create and
maintain software libraries that provide a predictable and consistent interface
to underlying platform-specific implementations. The primary goal is to
provide an API to which software developers may code and be assured of
predictable if not identical behaviour regardless of the platform on which
their software is built, relieving them of the need to code special-case
conditions to work around or take advantage of platform-specific deficiencies
or features.)
[[email protected] ~]# tar xf apr-1.5.1.tar.bz2 [[email protected] ~]# cd apr-1.5.1 [[email protected] ~]# ./configure --prefix=/usr/local/apr [[email protected] ~]# make && make install
编译安装apr-util
[[email protected] ~]# tar xf apr-util-1.5.3.tar.bz2 [[email protected] ~]# cd apr-util-1.5.3 [[email protected] ~]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr [[email protected] ~]# make && make install
安装依赖包pcre-devel
[[email protected] ~]# yum install pcre-devel
编译安装httpd
[[email protected] ~]# tar xf httpd-2.4.9.tar.bz2 [[email protected] ~]# cd httpd-2.4.9 [[email protected] ~]# ./configure --prefix=/usr/local/apache --enable-so --enable-ssl --enable-rewrite --enable-cgi --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all [[email protected] ~]# make && make install
在/etc/profile.d目录下创建httpd.sh环境变量文件
[[email protected] ~]# echo "export PATH=$PATH:/usr/local/apache/bin" > /etc/profile.d/httpd.sh [[email protected] ~]# source /etc/profile
httpd的测试与启动
[[email protected] ~]# apachectl -t Starting httpd: AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using web.test.com. Set the ‘ServerName‘ directive globally to suppress this message Syntax OK
编辑httpd.conf文件,搜索"/ServerName",添加ServerName localhost:80
[[email protected] ~]# apachectl start
时间: 2024-12-13 16:03:40