叙述Apache web server的安装与配置。

admin2009-02-15  12

问题 叙述Apache web server的安装与配置。

选项

答案Apache web server的安装与配置如下: 1.Apache web server简介 Apache web server是一款开放源码的web服务器软件,由apache software foundation开发和维护。它是目前世界上使用最为广泛的web服务器软件,支持各种unix平台和Windows平台。这里将介绍它在 RedHat Linux 9中最基本的安装和配置。 2:软件的相关资源 官方网站:http://httpd.apache.org/。 源码软件包:Apache是开源的软件,可以在其官方网站http://ht- tpd. apache. org/download. cgi下载。目前的最新稳定版本是httpd-2. 0.53。http://httpd.apache.org/docs-project/有该软件比较全面的帮 助文档。hap://httpd. apache. ore/docs/misc/FAQ.html回答了该软件的常见问题。 3.软件的安装 1)安装 从其官方网站下载源码软件包httpd-2.0.53.tartsz。接下来将对安装过程的一些重要步骤给出解释。 [root@localhostroot]#tarxzvfhttpd-2.0.53.tar.gz [root@loealhostroot]#cd htlpd-2.0.53 [root@loealhosthttpd-2.0.53]#./configure [root@localhosthttpd-2.0.53]#make [root@localhosthUpd-2.0.53]#makeinstall t8rxzvfhttpd-2.0.53.tartSz解压缩软件包。 ./configure针对机器作安装的检查和设置,大部分的工作是由机器自动完成的,但是用户可以通过一些参数来完成一定的设置,其常用选项如下。 /configure- -help查看参数设置帮助。 - -prefix:指定软件安装目录(默认usr/local/apache2)。 - -enable-modules=指定需要加载的模块。 - -enable-v4-mapped支持IPv6的socket处理1Pr4的连接。 可以设置的参数很多,可以通过-help查看需要的参数,一般情况下,默认设置就可以了。 默认安装建了/usr/local/apache2目录,下面介绍/usr/ loeal/a- pache2的几个常用组成部分。 /usr/local/apache2/bin其中主要是有服务器的程序。常用的有 demon程序httpd和控制脚本apachectl。 /usv/local/apache2/conf其中主要是服务器相关的配置文件。最主要的配置文件是httpd. conf。 /usr/loeal/apache2/htdocs默认的网站html文件根目录。 /usr/local/apache2/cgi-bin默认的cgi程序的存放目录。 2)启动 [root@localhostroot]#/usr/local/apache2/bia/apacheetlstart [root@localhostroot]卸salLX [root@loealhostroot]#netstat-oil 如果不出问题,ps aux应该可以查到httpd的进程,或netstat-an也可以看到80端口的服务已经启动了。如果要设置开机自启动web server,只需在/etc/rc.d/rc.10cal中加入一行 /usr/local/apache2/bin/apachectl start 该文件内容如下。 #!/bin/sh # #This script will bc executed*after*all the other init scripts. #You can put your owu initialization stuffin here ifyou dont #want to do the full Sys V style 1nit stuff touch/ var/ lock/ subsys/ local /usr/local/apache2/bin/apachectl start 4.软件的配置 /usr/local/apache2/conf/httpd. conf默认安装,所有的配置都有默认值,接下来介绍一些常用的配置项。 glisten: Allows you to bind Apache to specific IP addresses and/or #ports, instead of the default. See also the < Virtual Host > # directive. # #Change this to Listen on specific IP addresses as shown below to #prevent Apache from glomming onto all bound [P addresses ( 0.0.0. 0) # glisten 12.34.56.78:80 Listen 80 设定apache的侦听地址和端口。 # #Server Admin 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 # Server Admin you@ examplc, com 设定apache的管理员邮件地址。 # #Document Root The directory out of which you will serve your #documents. By default, all requests are taken from this directory, but #symbolic links and aliases may be used to point to other locations. # DocumentRoot"/usr/local/apache2/htdocs" 设定apache web server的文档根目录,必须是绝对路径。 < Dirnctory"/usr/local/apache2/htdocs" > # #Possible values for the Options directive are" None" ," All", #or any combination of: # Indexes Includes Follow Sym Links Sym LinksifOwner Match ExecCGI Muhi Views # #Note that" Muhi Views" must be named * explicitly * - - - "Options All" #doesn’t give it to you. # #The Options directive is both complicated and important. Please see #http: //httpd. apache, org/docs -2. O/mod/core. Html #options /flor more information. # Options Indexes Follow SymLinks # #Allow Override controls what directives may be placed in. htaccess files. #It can be" All" ," None" ,or any combination of the keywords: # Options Filelnfo Auth Config Limit # Allow Override None # #Controls who can get stuff from this server. # Order allow, deny Allow from all </Directory > 设定文工团档根目录的权限控制,必须和Docnment Root"/usr/local/a- pache2/htdoes"中指定的目录一致。 # #The index, html. var file( a type-map)is used to deliver content. #negotiated documents. The Muhi Views Option can be used for the #same purpose, but it is much slower. # Directorylndex index, html 指定该目录下的索引文档, ScriptAlias/cgi-bin/"/usr/local/apache2/cgi-bin/" 映射egi-bin 的根目录,必须是绝对路径。 < Directory"/usr/local/apache2/cgi-bin" > AllowOverride None Options None Order allow, deny Allow from all </Directory > 设定cgi—bin目录的读写权限,该目录项必须和上一条的设置一致。 5.安装使用的一些经验 1)apache进程的有效用户ID默认为n。b。dY 出于安全方面的考虑,up ache服务器进程的默认有效ID被设置为 nobody,这就意味着该进程只拥有nolmdy的权限,所以必须确保nobody对设置的Dxumcnt Root有足够权限。或者可以配置up achc进程的有效id,但是推荐不要这样做。 2)如果网站的访问量不是很大可以考虑用xinetd超级进程来启 动apache ①打开/usr/locaVapache2/coaf/httpd.conf,修改。 Server Type inetd ②创建/etc/xinetd. d/apache, 内容如下。 #defauh: on #description: The Apache HTTP connections. service http I disable=no socket_ type=stream wait=no user: root server=/usr/sbi/httpd port: 80 #log_ on_ success+=DURATION USERID #log_ on_ failure+=USERID #nice=10 } ③重新启动xinetd。 #/etc/rc. d/init .d/xinetd restart 3)对IPv6的支持 随着计算机网络的不断发展和扩大,IPv6已经越来越为人们所接受,apache自2.0之后的版本开始支持IPv6,下面简单介绍apache针对 IPv6的配置。 默认情况下,apache使用映射到IPv4的lPv6地址,即安装配置时,默认./configure-enable-v4-map,并且在配置文件http.conf中将是: Listen 80。 要使apache区别对待IPv4与IPv6的连接,安装配置时,使用./ configure-disable-v4-map,对应配置文件中http.conf:Listen[::]: 80。这样apache就可以区别对待IPV4与IPv6的连接了。

解析
转载请注明原文地址:https://kaotiyun.com/show/qc3Z777K
0

相关试题推荐
最新回复(0)