Linux安装Apache Web Server - graybull's Blog

Linux安装Apache Web Server

graybull posted @ 2013年2月28日 16:08 in Hi-perf Web Site with tags apache linux web server , 3184 阅读

嗯,我想构建个高性能Web站点来玩玩。就从这里开始吧。

  • 安装APR和APR-util
  • 安装PCRE
  • 安装httpd
  • 启动web server

OS是rhel6.1 x64。在httpd源代码目录下,执行./configure会出错,提示需要apr等包。这是因为httpd依赖于APR、APR-util和PCRE,需要先安装它们,后添加路径入configure的选项中。使用以下命令可获得帮助:

$./configure -help | grep apr

输出:

  --with-included-apr     Use bundled copies of APR/APR-Util
  --with-apr=PATH         prefix for installed APR or the full path to apr-config
  --with-apr-util=PATH    prefix for installed APU or the full path to

它告诉我需要加上apr和apr-util的路径。

安装APR和APR-util

从http://apr.apache.org/处下载APR和APR-util

  • APR

$ tar xvjf apr-1.4.6.tar.bz2 

$ cd apr-1.4.6

$sudo ./configure --prefix=/usr/local/apr

$sudo make

$sudo make install

  • APR-util

同样先解压后安装。

$./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

然后make,make install。

由于apr-util需要用到apr,故要添加--with-apr=/usr/local/apr。用-help可以查看:

$ ./configure -help |grep apr

安装PCRE

从http://www.pcre.org/处下载pcre代码包,解压。

$ sudo ./configure --prefix=/usr/local/pcre

然后make, make install

安装httpd

有了以上的包后,即可开始安装httpd:

$ sudo ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
$ sudo make

$ sudo make install

启动web server

  • 配置参数

配置文件 /usr/local/apache2/conf/httpd.conf

去掉ServerName的注释

  • 启动

$ /usr/local/apache2/bin/apachectl -k start
停止/重启为:stop/restart

apachectl是apache web server的前端程序,用来帮助管理员管理apache httpd后台程序的功能。

  • 测试

在浏览器打开 http://localhost,则显示/usr/local/apache2/htdocs/index.html的内容。

参考文献

http://httpd.apache.org/docs/2.4/install.html

Avatar_small
hotmail com login 说:
2019年9月07日 01:09

Thank you so much! I hope to see more updates from you, this helps me so much hotmail com login

Avatar_small
celebsagewiki 说:
2024年3月15日 00:19

It's a good chance to know more about these stories, very interesting and meaningful. And please take a look at this site, where I find the all the information I need about <a href="https://www.celebsagewiki.org/" title="famous celebrities">famous celebrities</a>


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee