Apache 2.4 For Windows 安装配置说明

来源:互联网 发布:怎样查看电脑mac地址 编辑:程序博客网 时间:2024/06/16 14:22
安装配置Apache

解压下载的安装包:httpd-win32-src.zip将其放到自己的安装目录(我的目录D:apacheApache24)

 

Apache

 

 我们先打开httpd.conf(D:apacheApache24confhttp.conf)配置文件进行修改-使用记事本打开就行(建议备份一份,此文件是主要的配置文件,改错了还能在找回来)

1.修改ServerRoot Apache的根路径:

CTRL+F 查找「ServerRoot "c:/Apache24"」改成——>「ServerRoot "d:/apache/Apache24"」

 

 

2.修改ServerName你的主机名称:

CTRL+F 查找#ServerName www.example.com:80」 将前面的#去掉,该属性在从命令行启动Apache时需要用到。

 

apache
3.修改DocumentRoot Apache访问的主文件夹目录,就是php、html代码文件的位置。Apache默认的路径是在htdocs(D:apacheApache24htdocs)下面,里面会有个简单的入口文件index.html。这个路径可以自己进行修改,我这里将其配置在我自己新建的文件夹www(D:apachewww)下。

DocumentRoot "c:/Apache24/htdocs"

<Directory "c:/Apache24/htdocs">

改为=>

DocumentRoot "d:/apache/www"

<Directory "d:/apache/www">

 

apache

 

4.修改入口文件配置:DirectoryIndex一般情况下我们都是以index.php、index.html、index.htm作为web项目的入口。Apache默认的入口只有index.html需要添加其他两个的支持,当然这个入口文件的设置可以根据自己的需要增减,如果要求比较严格的话可以只写一个index.php,这样在项目里面的入口就只能是index.php

<IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

改为=>

<IfModule dir_module>

    DirectoryIndex index.html index.php index.htm 

</IfModule>

 

apache

 

5.设定serverscript的目录:

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>

 

 

启动Apache

 开始---运行,输入cmd,打开命令提示符。接着进入D:apacheApache24bin目录下运行httpd

 

 

测试是否配置正常,在地址栏输入http://127.0.0.1,我是本地配置的,就输入这个地址,或者输入本机的私网地址。

 

apache

 

0 0
原创粉丝点击