1,Apache下載
選擇一個(gè)版本,點(diǎn)擊Download
點(diǎn)擊File For Microsoft Windows
由于Apache HTTP Server官方不提供二進(jìn)制(可執(zhí)行)的發(fā)行版,所以我們選擇一些貢獻(xiàn)者編譯完成的版本,我們選擇第一個(gè)ApacheHaus
點(diǎn)擊ApacheHaus,進(jìn)入下載頁(yè)
選擇其中一個(gè)版本,如果你的Windows還沒(méi)安裝對(duì)應(yīng)的VC環(huán)境的話(huà),選擇對(duì)應(yīng)的VCRedistribute版本下載安裝。我選擇Apache 2.4VC9版,因?yàn)槲业碾娔X中已經(jīng)安裝了VC9的環(huán)境。
點(diǎn)擊JumpLinks下第一行的某一個(gè)版本,下載對(duì)應(yīng)壓縮包。
2,配置Apache之一--httpd.conf
解壓后進(jìn)入里面Apache22(最后兩位數(shù)字可能不同)文件夾,使用文本編輯器(推薦ultraedit)打開(kāi)conf文件夾中的httpd.conf配置文件
找到ServerRoot選項(xiàng),設(shè)置Apache目錄,大約在35行左右,將其改成你的Apache程序的文件夾,例:
ServerRoot "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22" |
找到Listen選項(xiàng),設(shè)置端口,大約46行,一般不修改,使用默認(rèn)80,在開(kāi)啟服務(wù)器前請(qǐng)保證80端口未被占用
找到DocumentRoot選項(xiàng),修改服務(wù)器根目錄,例:
DocumentRoot "F:/" |
請(qǐng)保證此目錄存在,否則服務(wù)器無(wú)法正常啟動(dòng)
修改Directory,保證其與服務(wù)器根目錄相同,只修改下面的第一行中引號(hào)部分
<Directory "F:/"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" 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.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Order allow,deny Allow from all</Directory> |
找到ScriptAlias選項(xiàng),設(shè)置服務(wù)器腳本目錄,大約326行,一般將其設(shè)置為Apache目錄下的cgi-bin文件夾
ScriptAlias /cgi-bin/ "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/cgi-bin" |