亚洲成精品动漫久久精久,九九在线精品视频播放,黄色成人免费观看,三级成人影院,久碰久,四虎成人欧美精品在永久在线

掃一掃
關(guān)注微信公眾號

教你在Redhat 上搭建 Apache 服務(wù)器
2006-07-11   cn.zhaoke.com 

一. Apache介紹

Apache HTTP服務(wù)器是現(xiàn)在互連網(wǎng)上最流行的Web服務(wù)器. 眾所周知, 它的

最早版本是于1995年12月1日發(fā)布的. 最初的Apache版本是由美國伊利諾斯

大學(xué)香檳分校(University of Illinios, Urbana-Champaign.)國家超級

計(jì)算應(yīng)用中心(NCSA)的Rob McCool先生開發(fā)的the Public Domain HTTPS

Daemon程序發(fā)展而來. 它具有強(qiáng)大的功能, 如基于名字和IP地址的虛擬主機(jī),

用戶驗(yàn)證, URL重定向(URL Rewrite), SSI(服務(wù)器端嵌入), SSL(安全套接層)

等更多.

提示:

互連網(wǎng)上大概有65%的Web服務(wù)器使用Apache HTTP服務(wù)器. 這個(gè)數(shù)字是通過

Netcraft網(wǎng)站了解的. 如果您對互連網(wǎng)上Web服務(wù)器調(diào)查報(bào)告感興趣的話,

可以訪問以下的網(wǎng)址:

http://news.netcraft.com/archives/web_server_survey.html

現(xiàn)在最新的數(shù)據(jù)是: Apache (68.4%), Microsoft (20.9 %), 其它(10.7 %).

查詢時(shí)間: 2004-01-31 11:34 北京時(shí)間

二. Apache HTTP版本的選擇

現(xiàn)在Apache HTTP有兩種版本系列: Apache 1.3 或 Apache 2.0

如何選擇版本? 簡而言之, Apache 1.3系列的版本強(qiáng)調(diào)是穩(wěn)定性; Apache 2.0

強(qiáng)調(diào)的是新功能的支持.

Apache 1.3新的功能:

http://httpd.apache.org/docs/new_features_1_3.html

Apache 2.0新的功能:

http://httpd.apache.org/docs-2.0/new_features_2_0.html (英文)

https://support.iap.ac.cn/net/ApacheManual/zh-cn/ (中文)

本文中使用的是Apache 1.3.3版本.

三. 準(zhǔn)備工作

說明:

所有的命令行操作使用的是root用戶.

Apache軟件包是源文件的發(fā)布形式.

Shell命令環(huán)境中#表示當(dāng)前用戶權(quán)限為root,

$表示當(dāng)前擁護(hù)權(quán)限為普通用戶.

1. 移去已經(jīng)安裝的Apache HTTP Server RPMs包.

如果您的系統(tǒng)沒有安裝過Apache, 請參考步驟2.

1) 查詢跟httpd相依賴的軟件包.

#rpm -q --whatrequires httpd

說明:

2) 從系統(tǒng)中移去以下的軟件包.

#rpm -e redhat-config-httpd

#rpm -e httpd

3) 查詢是否存在httpd進(jìn)程, 如有, 用killall命令終止httpd進(jìn)程.

#ps aux|grep httpd

#killall httpd

2. 下載和解壓縮Apache HTTP軟件包.

建議從apache的官方網(wǎng)站獲得可靠的apache HTTP軟件包.

下載網(wǎng)址: http://httpd.apache.org/download.cgi

1) 創(chuàng)建apache軟件包存放的目錄.

#mkdir -p /usr/local/src/webserver

2) 使用wget命令獲得源代碼包.

#wget http://apache.tarchive.com/httpd/apache_1.3.33.tar.gz

3) 解壓縮源代碼包, 在webserver目錄下會生成一個(gè)新的目錄apache_1.3.33

#tar zpxf apache_1.3.33.tar.gz

四. 安裝Apache Web Server 1.3.3

這里我使用的是DSO(Dynamic Shared Objects)的方式來安裝Apache HTTP服務(wù)器.

使用DSO的安裝方式允許您在以后不需要重新編譯Apache的情況下添加模塊.

如PHP等等.

1) 創(chuàng)建安裝腳本apache_inst.

#cd /usr/local/src/webserver

#vi apache_inst

---拷貝下面區(qū)域內(nèi)容然后張貼到apache_inst中--

cd /usr/local/src/webserver/apache_1.3.33

./configure

--prefix=/www

--enable-module=so

--enable-module=rewrite

--enable-shared=rewrite

--enable-module=setenvif

--enable-shared=setenvif

--enable-module=mime

--enable-shared=mime

--enable-module=mime_magic

--enable-shared=mime_magic

--enable-module=dir

--enable-shared=dir

--enable-module=auth

--enable-shared=auth

--enable-module=access

--enable-shared=access

--enable-module=alias

--enable-shared=alias

--enable-module=status

--enable-shared=status

--enable-module=userdir

--enable-shared=userdir

--enable-module=env

--enable-shared=env

--enable-module=log_referer

--enable-shared=log_referer

--enable-module=log_config

--enable-shared=log_config

--enable-module=log_agent

--enable-shared=log_agent

--enable-module=headers

--enable-shared=headers

------------------結(jié)束----------------------

#chmod +x apache_inst

說明: 設(shè)置apache_inst文件的可執(zhí)行權(quán)限.

2) 執(zhí)行安裝腳本apache_inst.

#./apache_inst

3) 到源代碼文件所在目錄編譯和安裝Apache Web Server.

#cd /usr/local/src/webserver/apache_1.3.33

#make

#make install

4) 創(chuàng)建apache控制命令的軟鏈接.

#ln -s /www/bin/apachectl /usr/bin/apachectl

#ln -s /www/bin/apachectl /usr/sbin/apachectl

5) 運(yùn)行Apache Web服務(wù)器.

#apachectl start

相關(guān):

#apachectl start 啟動apache.

#apachectl stop 停止apache.

#apachectl restart 重新啟動apache.

#apachectl status 顯示apache的狀態(tài).

#apachectl configtest 測試httpd.conf配置是否正確.

6) 讓系統(tǒng)啟動時(shí)自動運(yùn)行Apache Web服務(wù)器.

#vi /etc/rc.d/rc.local

說明: 在rc.local文件最后添加下面一行.

apachectl start

五. 測試Apache Web服務(wù)器是否運(yùn)行.

您可以在瀏覽器中通過機(jī)器的主機(jī)名或者IP地址以http://yourdomain.com

或者h(yuǎn)ttp://192.168.0.1(此出輸入您機(jī)器的IP地址)訪問Web服務(wù). 您將會

看到一個(gè)成功安裝Apache HTTP服務(wù)器的臨時(shí)網(wǎng)頁.

六. Apache HTTP的安裝目錄

Apache HTTP服務(wù)器到此已經(jīng)安裝到系統(tǒng)中, 安裝的目錄是/www. 接下來

了解每一個(gè)目錄的用途:

/www 也叫ServerRoot, 用于放置所有安裝后的Apache相關(guān)文件.

/www/bin 用于放置apache的運(yùn)行程序.

/www/cgi-bin 缺省用于運(yùn)行如perl腳本的cgi-bin目錄.

/www/conf 用于放置所有的配置文件如httpd.conf等.

/www/htdocs Apache Web服務(wù)器的Document Root目錄. htdocs這里全稱

是http documentations, 即用于存放web網(wǎng)頁.

/www/icons 用于放置Apache Web服務(wù)器的圖標(biāo). 如Directory

Listing用到的圖標(biāo).

/www/includes 用于放置運(yùn)行Apache Web服務(wù)器用到的頭文件.

/www/libexec 用于放置您在安裝編譯時(shí)候用到的模塊.

/www/logs 缺省用于放置Apache Web服務(wù)器運(yùn)行的所有活動日志.

/www/man 用于放置幫助文件.

/www/proxy 用于配置proxy相關(guān)內(nèi)容.

七. Apache HTTP的配置文件

Apache配置文件為httpd.conf, 所在目錄/conf, 這里我只對本文apache用

的httpd.conf文件列出一個(gè)清單.更多信息的httpd.conf文件指令解釋請

參考網(wǎng)上相關(guān)內(nèi)容.

ServerType standalone

ServerRoot "/www"

PidFile /www/log/httpd.pid

ScoreBoardFile /www/logs/httpd.scoreboard

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

MinSpareServers 5

MaxSpareServers 10

StartServers 5

MaxClients 150

MaxRequestPerChild 0

LISTEN 210.77.144.83:80

BindAddress *

LoadModule name file

AddModule header file name

Port 80

User nobody

Group nobody

ServerAdmin root@islab.org

ServerName www.islab.org

DocumentRoot "/www/htdocs"

Directory

UserDir

DirectoryIndex files

DirectoryIndex index.html

AccessFileName .htaccess

Order allow,deny

Deny from all

Satisfy All

UseCanonicalName On

TypesConfig

TypesConfig /www/conf/mime.types

DefaultType text/plain

MIMEMagicFile /www/conf/magic

MIMEMagicFile /www/conf/magic

HostnameLookups Off

ErrorLog /www/logs/error_log

LogLevel warn

LogFormat

CustomLog /www/logs/access_log common

ServerSignature On

Alias /icons/ "/www/icons/"

ScriptAlias /cgi-bin/ "/www/cgi-bin/"

IndexOptions FancyIndexing

NameVitualHost *

VirtualHost

熱詞搜索:

上一篇:初步學(xué)習(xí)了解Apache:基礎(chǔ)介紹和配置
下一篇:雙核PC服務(wù)器在中型企業(yè)市場率先突破

分享到: 收藏