PHP環(huán)境搭建——httpd-2.4.23壓縮包配置安裝
2016-11-19 03:37:20
13898
1.準(zhǔn)備安裝包
我從http://www.tjdsmy.cn/下載的安裝包httpd-2.4.23-win64-VC14.zip
2.解壓
我解壓在D盤,文件目錄如下
3.修改配置文件httpd.conf
修改Apache24->conf下的httpd.conf
①修改ServerRoot的根路徑:
將
ServerRoot "c:/Apache24"
改為
ServerRoot "d:/Apache24"
②修改ServerName你的主機(jī)名稱:
將
#ServerName www.tjdsmy.cn:80
改為
ServerName www.tjdsmy.cn:80
③修改DocumentRoot訪問的主文件夾目錄
將
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
?為
DocumentRoot "d:/www"
<Directory "d:/www">
我在D盤創(chuàng)建了名為www的文件夾,用于存放php應(yīng)用程序的,相當(dāng)于wamp集成開發(fā)環(huán)境中的www文件夾
④修改入口文件DirectoryIndex
將
DirectoryIndex index.html
改為
DirectoryIndex index.php index.html index.htm
⑤設(shè)定ScriptAlias的目錄:
將
ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"
改為
ScriptAlias /cgi-bin/ "d:/Apache24/cgi-bin/"
⑥修改CGI directory
將
<Directory "c:/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
改為
<Directory "d:/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
4.安裝Apache24服務(wù)
以管理員身份運(yùn)行cmd,并切換到Apache24的bin目錄
輸入
httpd.exe -k install -n "Apache24"
cmd命令輸入services.msc
這時(shí)候httpd已經(jīng)篇日志完成。
5.測試Apache
打開Apache24服務(wù),將Apache24下htdocs中的index.html文件復(fù)制到www目錄下。
打開瀏覽器,在地址欄中輸入localhost/index.html回車
這是Apache服務(wù)器配置完成。