解压下载的安装包:httpd-win32-src.zip将其放到自己的安装目录(我的目录D:apacheApache24)
我们先打开httpd.conf(D:apacheApache24confhttp.conf)配置文件进行修改-使用记事本打开就行(建议备份一份,此文件是主要的配置文件,改错了还能在找回来)
CTRL+F 查找「ServerRoot "c:/Apache24"」改成——>「ServerRoot "d:/apache/Apache24"」
CTRL+F 查找「#ServerName www.example.com:80」 将前面的#去掉,该属性在从命令行启动Apache时需要用到。
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
改为=>
DocumentRoot "d:/apache/www"
<Directory "d:/apache/www">
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
改为=>
<IfModule dir_module>
DirectoryIndex index.html index.php index.htm
</IfModule>
ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"改为=> ScriptAlias /cgi-bin/ "d:/apache/Apache24/cgi-bin"
<Directory "c:/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
改为
<Directory"d:/apache/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
开始---运行,输入cmd,打开命令提示符。接着进入D:apacheApache24bin目录下运行httpd
测试是否配置正常,在地址栏输入http://127.0.0.1,我是本地配置的,就输入这个地址,或者输入本机的私网地址。