热门关键字:  ubuntu  分区  函数  linux系统进程  Fedora

细述 Apache web server 的安装与配置

来源: 作者: 时间:2007-03-24 Tag: 点击:

一.、Apache web server 简介

Apache web server是一款开放源码的web服务器软件,由apache software foundation 开发和维护的。它是目前世界上使用最为广泛的web服务器软件,支持各种unix平台和windows平台。本文将介绍它在Red hat Linux 9中最基本的安装和配置。

二、软件的相关资源

官方网站:http://httpd.apache.org/
源码软件包:Apache 是开源的软件,可以去其官方网站http://httpd.apache.org/download.cgi下载。目前的最新稳定版本是httpd-2.0.53。
帮助文档:http://httpd.apache.org/docs-project/ 有该软件比较全面的帮助文档。
FAQ:http://httpd.apache.org/docs/misc/FAQ.html 回答了该软件的常见问题。
三.软件的安装

1.安装

由其官方网站中下载其源码软件包httpd-2.0.53.tar.gz。接下来我将对安装过程的一些重要步骤,给出其解释:

[root@localhost root]#tar xzvf httpd-2.0.53.tar.gz
[root@localhost root]#cd httpd-2.0.53
[root@localhost httpd-2.0.53]#./configure
[root@localhost httpd-2.0.53]#make
[root@localhost httpd-2.0.53]#make install

 

tar xzvf httpd-2.0.53.tar.gz 解压缩软件包。

./configure 针对机器作安装的检查和设置,大部分的工作是由机器自动完成的,但是用户可以通过一些参数来完成一定的设置,其常用选项有:

./configure --help 察看参数设置帮助。

--prefix= 指定软件安装目录(默认/usr/local/apache2)。

--enable-modules= 指定需要加载的模块。

--enable-v4-mapped 支持ipv6的socket处理ipv4的连接。

可以设置的参数很多,可以通过 -help察看需要的,一般情况下,默认设置就可以了。

默认安装建立了/usr/local/apache2目录,下面介绍一下/usr/local/apache2的几个常用组成部分:

/usr/local/apache2/bin 其中主要是有服务器的程序。常用的有deamon程序httpd,和控制脚本apachectl。

/usr/local/apache2/conf 其中主要是服务器相关的配置文件。最主要的配置文件是httpd.conf。

/usr/local/apache2/htdocs 默认的网站html文件根目录。

/usr/local/apache2/cgi-bin 默认的cgi程序的存放目录。

2.启动:

[root@localhost root]# /usr/local/apache2/bin/apachectl start
[root@localhost root]# ps aux
[root@localhost root]# netstat -an

 

如果不出什么问题,ps aux 应该可以查到httpd 的进程,或netstat -an 也可以看到80端口的服务已经起来了。如果要设置开机自启动web server,只需在/etc/rc.d/rc.local中加入一行

/usr/local/apache2/bin/apachectl start

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local

/usr/local/apache2/bin/apachectl start


四、软件的配置。

/usr/local/apache2/conf/httpd.conf 默认安装,所有的配置都有其默认值,接下来我介绍介绍一些常用的配置项:

 

 

 

 

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80

Listen 80

 

设定apache 的侦听地址和端口。

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com

上一篇:高性能LINUX双效防火墙HOWTO
下一篇:没有了
最新评论共有 4 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册