Linux下编译安装Apache Http Server
Linux下编译安装Apache Http Server
1.下载httpd-2.4.12.tar.bz2
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.12.tar.bz2
2.解压下载的文件##
tar -xjvf httpd-2.4.12.tar.bz2
3.configure配置编译安装条件
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
| 配置 | 说明 |
|---|---|
| --prefix=/usr/local/apach2 | 设置编译安装到的系统目录 |
| --enable-s | 使httpd服务能够动态加载模块功能 |
| --enable-rewrite | 使httpd服务具有网页地址重写功能 |
ARP not found 错误
o@o-pc:~/work/Apache-httpd-2.4.12$ ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
解决办法
下载 arp-1.5.2的源码包
解压后编译安装
o@o-pc:~/work/arp$ tar -xjvf apr-1.5.2.tar.bz2
o@o-pc:~/work/arp/apr-1.5.2$ ./configure --prefix=/usr/local/apr
...
o@o-pc:~/work/arp/apr-1.5.2$ make
...
o@o-pc:~/work/arp/apr-1.5.2$ sudo make install
APR-util not found 错误
o@o-pc:~/work/Apache-httpd-2.4.12$ ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
checking for chosen layout... Apache
...
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
解决办法
下载 apr-util-1.5.4 源码包
o@o-pc:~/work/arp$ wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.bz2
解压后编译安装
注意./configure配置的时候需要制定APR路径--with-apr=/usr/local/apr是前面编译安装apr的时候设置的路径。
o@o-pc:~/work/arp$ tar -xjvf apr-util-1.5.4.tar.bz2
o@o-pc:~/work/arp/apr-util-1.5.4$ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
...
o@o-pc:~/work/arp/apr-util-1.5.4$ make
...
o@o-pc:~/work/arp/apr-util-1.5.4$ sudo make install
pcre-config for libpcre not found错误
o@o-pc:~/work/Apache-httpd-2.4.12$ ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-apr-util=/usr/local/apr-util
checking for chosen layout... Apache
...
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... yes
...
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决办法
下载pcre-8.36源码包
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.bz2
8.7版本的地址
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2
解压后编译安装
o@o-pc:~/work/arp$ tar -xjvf pcre-8.37.tar.bz2
o@o-pc:~/work/arp/pcre-8.37$ ./configure --prefix=/usr/local/pcre
...
o@o-pc:~/work/arp/pcre-8.37$ make
...
o@o-pc:~/work/arp/pcre-8.37$ sudo make install
上面的错误解决后,再次./configure配置
注意添加的两个--with-...
o@o-pc:~/work/Apache-httpd-2.4.12$ ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
4.编译安装
o@o-pc:~/work/Apache-httpd-2.4.12$ make
o@o-pc:~/work/Apache-httpd-2.4.12$ sudo make install
5.启动apache服务
o@o-pc:~/work$ /usr/local/apache2/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
注意,需要root权限
o@o-pc:~/work$ sudo /usr/local/apache2/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
提示错误,无法确定服务名(就是端口号)
切换到目录/usr/local/apache2/conf
vi编辑文件httpd.conf(文件是只读的,修改需要root权限)
o@o-pc:/usr/local/apache2/conf$ sudo vi httpd.conf
添加一行
ServerName localhost:80
然后重新启动服务试试
o@o-pc:~$ sudo /usr/local/apache2/bin/apachectl start
httpd (pid 31083) already running
现在我们可以试试是否生效了
打开浏览器,输入地址localhost回车看看是否显示 Is Work!
显示了就说们Apache Http Server已经在运行了
不方便截图,这里直接用curl来获取下网页的内容
o@o-pc:~$ curl localhost
<html><body><h1>It works!</h1></body></html>
6.停止Apache Http 服务
可以看到停止后再去获取就失败了
o@o-pc:~$ sudo /usr/local/apache2/bin/apachectl stop
o@o-pc:~$ curl localhost
curl: (7) Failed to connect to localhost port 80: 拒绝连接
Linux下编译安装Apache Http Server的更多相关文章
- Linux下编译安装Apache及模块
Apache是时下最流行的Webserver软件之中的一个,支持多平台,可高速搭建web服务,并且稳定可靠.并可通过简单的API扩充.就能够集成PHP/Python等语言解释器. 文章这里解说怎样在l ...
- Linux下编译安装Apache 2.4
Linux一般会自带httpd服务,但是版本一般不是最新,性能也不是最好,生产中建议手动安装官方源码包,安装Apache官方包之前首先要停止之前的httpd服务,停止后也可以卸载之前的版本 准备工作做 ...
- Linux下编译安装Apache报APR not found错误的解决办法
我在编译安装完Nginx.MySQL和PHP(见之前一篇博客:LNMP环境搭建详细教程)之后,进行apache的编译安装: cd /usr/local/src wget http:.tar.gz ta ...
- linux下编译安装apache
在linux(CentOS6.5)上安装Apache,要首先确保以下程序事先安装 apr:The mission of the Apache Portable Runtime (APR) projec ...
- CentOS 下编译安装Apache
CentOS 下编译安装Apache 卸载原有的apache 首先从 http://httpd.apache.or 下载apache源码包httpd-2.4.4.tar.gz然后从 http://ap ...
- linux中编译安装Apache、PHP、MySQL(上)
1.简介 在阿里云买了个云服务器,一直没时间折腾.过了近十天了吧,才有时间好好玩玩这个云服务器.自己是做Web开发的,所以我需要的开发环境是LAMP.之前打算是采用yum安装,不过yum安装apach ...
- 在linux下手动安装 apache, php, mysql--终极版
在linux下手动安装 apache, php, mysql: 参考: http://www.cnblogs.com/lufangtao/archive/2012/12/30/2839679.html ...
- (转)Linux下编译安装log4cxx
Linux下编译安装log4cxx 一个项目的服务器端在Linux平台下,用到了开源日志库log4cxx,这个库是apache项目的一个子库.功能很不错.下面记录下它的编译和安装过程. log4cxx ...
- LINUX下编译安装PHP各种报错大集合
本文为大家整理汇总了一些linux下编译安装php各种报错大集合 ,感兴趣的同学参考下. nginx1.6.2-mysql5.5.32二进制,php安装报错解决: 123456 [root@clien ...
随机推荐
- 使用docker安装lamp
docker search -s 10 lamp #搜索被收藏或使用较多的LAMP镜像,小伙伴们都推荐使用tutum/lamp docker pull tutum/lamp #下载镜像 #使用默认方式 ...
- VirtualBox5中安装的CentOS6.7安装增强工具
1.安装编译内核的相关组件 yum install kernel-devel gcc 2.安装VirtualBox增强功能 sh ./VBoxLinuxAdditions.run 3.重启系统 reb ...
- Nginx使用webbench进行压力测试
在运维工作中,压力测试是一项非常重要的工作.比如在一个网站上线之前,能承受多大访问量.在大访问量情况下性能怎样,这些数据指标好坏将会直接影响用户体验. 但是,在压力测试中存在一个共性,那就是压力测试的 ...
- js日历插件 中文、英文日历
日历插件 来源网站:http://www.cnblogs.com/yank/archive/2008/08/14/1267746.html 六款英文日历 http://www.bobd.cn/desi ...
- thinkphp 3.2响应头 x-powered-by 修改
起初是看到千图网的登录链接 查看到的 自己做的网站也看了下 修改的办法就是TP3.2.2 的框架里 具体路径是D:\www\ThinkPHP\Library\Think\View.class.php ...
- Yii2 如何更好的在页面注入JavaScript
先添加一个widgets <?php /** * User: yiqing * Date: 14-9-15 * Time: 下午12:09 */ namespace common\widgets ...
- MD5 (摘要加密)
MD5 约定 同样的密码,同样的加密算法,每次加密的结果是不一样 密码方案 方案一:直接 MD5 pwd = pwd.md5String; 非常不安全 方案二 MD5 + 盐 pwd = [pwd s ...
- Block 及注意事项
block 概念 block 是 C 语言的 是一种数据类型,可以当作参数传递 是一组预先准备好的代码,在需要的时候执行 block 的注意事项 (1)block 在实现时就会对它引用到的它所在方法中 ...
- Coding上传项目步骤
step1:在coding上面创建一个项目mybokestep2:在git 命令台中进入项目的根目录下面,使用git init创建.git文件夹和.gitigonre文件,帮组本地与远程的链接step ...
- Entity Framework实例详解
Entity Framework Code First的默认行为是使用一系列约定将POCO类映射到表.然而,有时候,不能也不想遵循这些约定,那就需要重写它们.重写默认约定有两种方式:Data Anno ...