搭建Apache HTTP Server(编译安装)

mkdir /apache   #创建一个Apache目录,位置随你们习惯
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.25.tar.bz2   #下载apache源码
tar -jxvf httpd-2.4.25.tar.bz2   #解压缩



编译时可能会有各种问题,比如
checking for APR... no
configure: error: APR not found .  Please read the documentation

下载所需软件包:
    wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz  
    wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz  
    wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

解决过程中出现的问题:
1.apr not found问题
tar -zxvf apr-1.4.5.tar.gz  
cd  apr-1.4.5  
./configure --prefix=/usr/local/apr  
make && make install

2.APR-util not found问题
tar -zxvf apr-util-1.3.12.tar.gz  
cd apr-util-1.3.12  
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config  
make && make install

3.pcre问题
unzip -o pcre-8.10.zip  
cd pcre-8.10  
./configure --prefix=/usr/local/pcre  
make && make install

解决上述问题时可能出现gcc/g++:command not found,解决方法:
yum -y install gcc
rpm -qa | grep "g++"   #检查是否缺失相应的包
yum whatprovides "*/g++"   #确认未安装之后,查询可安装的包
yum install gcc-c++-XXXXXXXXX.x86_64   #利用yum安装查询到的包



安装apache:
cd httpd-2.4.25   #切换到httpd目录
./configure --prefix=/opt/httpd-2.4.25 \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--with-pcre=/usr/local/pcre \
--enable-so \   #支持DSO模式(动态共享目标)
--enable-mods-shared=most \   #动态编译大部分常用的模块
--enable-proxy-balancer=shared \   #支持负载均衡
--enable-proxy-http=shared \   #http代理模块
--enable-proxy-ajp \   #proxy-ajp模块
--enable-rewrite   #支持地址重写功能

make
make install

/opt/http-2.4.25//bin/apachectl start   
#如果出现httpd: Could not reliably determine the server‘s fully qualified domain name
vi /opt/httpd-2.4.25/conf/httpd.conf
  :?#ServerName
  #新起一行添加ServerName localhost:80
  :wq
/opt/httpd-2.4.25/bin/apachectl stop

cp /opt/httpd-2.4.25/bin/apachectl /etc/init.d/httpd    #将apache的启动脚本复制到/etc/rc.d/init.d这个目录下
vi /etc/rc.d/init.d/apache

   // 这里是编辑apache启动脚本,在开头的#!/bin/sh  下面加上 #chkconfig: 2345  85  15
chkconfig --add apache    //添加apache服务
chkconfig --list apache    //列出apache服务
/etc/init.d/httpd start   #启动apache
netstat -lntp| grep 80 (netstat -an | grep:80)  #检验apache已开启
lsof -i :80   #查看当前系统文件打开情况

wget http://192.168.10.254   #检验是否能访问
浏览器打开 192.168.10.254(It works!)

#浏览器访问不了可能是服务器防火墙开着
service apache status   
service apache stop

时间: 2024-08-26 05:40:39

搭建Apache HTTP Server(编译安装)的相关文章

apache/mysql/php编译安装及支持xcache和fastcgi方式运行

一.编译安装apache     1.安装环境:yum install gcc gcc-c++ openssl-devel libtool -y     2.安装apr.apr-util及pcre         tar jxf apr-1.5.1.tar.bz2         cd apr-1.5.1         ./configure --prefix=/usr/local/apr         make && make install              tar jxf

Apache http server linux 安装过程说明

PS:Apache http server 需要依赖 apr.apr-util.pcre,所以要先下载和安装这三个东东.而apr-util和pcre又依赖apr,所以要先安装apr. 步骤: 1.  下载apr.apr-util.pcre.Apache httpserver 地址如下: apr/ apr-util: http://apr.apache.org/download.cgi pcre: http://www.pcre.org/ apache http server: http://ht

Apache源码编译安装

精髓前言: 解析JAVA程序用:tomcat.resin.weblogic.jboss 解析.asp .aspx程序用:pws,iis  后端数据库为:sql server,access IP PV UV: IP:internet protocol    --internet协议 pv:page view         --访问量 uv:unique visitor      --独立访客 简单介绍cookie: cookie: 访问一个网站的时候,网站就会给你发一个cookie,独一无二的

centos 7.1 apache 源码编译安装

Apache编译安装 一,需要软件: 1.apr-1.5.2.tar.gz 2.apr-util-1.5.4.tar.gz 3.pcre-8.38.tar.gz 4.httpd-2.4.23.tar.gz 二,安装apr yum install gcc libtools -y    tar zxf apache/apr-1.5.2.tar.gz   cd apr-1.5.2  ./configure --prefix=/usr/local/apr make && make install

Apache二进制免编译安装和参数配置

下载http相关二进制软件包 cd /usr/local/src/ wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.34.tar.gz wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz 说明:apr和apr-util是一个通用的函数库,它让httpd可以不

Apache http Server 新版本安装与配置

前言 Apache官网从2.2之后,不再提供windows的msi或exe安装版本,现在Apache http Server有两个分支2.2及2.4 注:如果之前有安装2.2的版本,请先卸载 下载 1.进入apache官网:https://httpd.apache.org/download.cgi 2.选择2.4的版本,点击 Files for Microsoft Windows  (windows安装版本) 3.选择前三个网站中的任意一下进入下载,(推荐Apache Lounge镜像站点快)

ubuntu server编译安装nginx

刚刚安装好了ubuntu server14.04,如今要安装一个webserver,纯静态就用nginx应用程序server吧,性能出众啊. 安装编译环境 我们这里採用源代码编译安装的方式,大家能够看到非常多东西. 保证已经安装了openSSH,然后用putty连接到ubuntu,然后首先安装编译环境,由于是新安装的系统,必须做这步,除非已经安装过了. sudo apt-get install build-essential sudo apt-get install gcc 有人说 sudo a

apache的源代码编译安装

1.下载Apache安装包,下载地址http://httpd.apache.org/,我下载的是httpd-2.4.16,是最新的:然后对安装包进行解压,并进行初始化配置和编译安装: 编译命令: ./configure –prefix=/usr/local/apache –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –with-pcre=/usr/local/pcre(这是初始化配置,--prefix代表apache安装的

搭建 Apache Http Server 服务器

本人的个人博客为:www.ourd3js.com csdn博客为:blog.csdn.net/lzhlzz 转载请注明出处,谢谢. Apache HTTP Server(简称 Apache)是 Apache 软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,由于其多平台和安全性被广泛使用,是最流行的 Web 服务器端软件之一.Apache 软件基金会中还有一个著名的服务器软件,叫Tomcat .Apache HTTP Server 和 Tomcat 的区别和联系是: Apa

搭建Yum服务器及编译安装Httpd

搭建yum服务器 编译安装Httpd 原文地址:http://blog.51cto.com/10461810/2106438