Windows Apache2.4 VC9(ApacheHaus)安装教程详解


本文摘自PHP中文网,作者巴扎黑,侵删。

这篇文章主要介绍了Windows Apache2.4 VC9(ApacheHaus)详细安装配置教程,需要的朋友可以参考下

1,Apache下载

选择一个版本,点击Download

点击File For Microsoft Windows

由于Apache HTTP Server官方不提供二进制(可执行)的发行版,所以我们选择一些贡献者编译完成的版本,我们选择第一个ApacheHaus

点击ApacheHaus,进入下载页

选择其中一个版本,如果你的Windows还没安装对应的VC环境的话,选择对应的VCRedistribute版本下载安装。我选择Apache 2.4VC9版,因为我的电脑中已经安装了VC9的环境。

点击JumpLinks下第一行的某一个版本,下载对应压缩包。

2,配置Apache之一--httpd.conf

解压后进入里面Apache22(最后两位数字可能不同)文件夹,使用文本编辑器(推荐ultraedit)打开conf文件夹中的httpd.conf配置文件

找到ServerRoot选项,设置Apache目录,大约在35行左右,将其改成你的Apache程序的文件夹,例:

1

ServerRoot "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22"

找到Listen选项,设置端口,大约46行,一般不修改,使用默认80,在开启服务器前请保证80端口未被占用

找到DocumentRoot选项,修改服务器根目录,例:

1

DocumentRoot "F:/"

请保证此目录存在,否则服务器无法正常启动

修改Directory,保证其与服务器根目录相同,只修改下面的第一行中引号部分

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

<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选项,设置服务器脚本目录,大约326行,一般将其设置为Apache目录下的cgi-bin文件夹

1

ScriptAlias /cgi-bin/ "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/cgi-bin"

找到随后的Directory选项,设置脚本目录,大约342行,需要将其设置为和前面的ScriptAlias目录相同

1

2

3

4

5

6

<Directory "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/cgi-bin">

  AllowOverride None

  Options None

  Order allow,deny

  Allow from all

</Directory>

3,配置Apache之二--ssl配置

如果你这使启动服务,一般会出现下面的消息对话框:

提示

Windows不能在本地计算机启动Apache2.2。有关更多信息,查阅系统日志文件。如果这是非Microsoft服务,请与厂商联系,并参考特定服务器错误代码1。

确定此问题的原因:

右键 计算机,点击管理->Windows日志->应用程序,显示如下

这是由于SSL配置不正确所产生的,下面说一下解决办法。

打开Apache程序目录下的conf/extra/httpd-ahssl.conf文件,配置VirtualHost选项,有三处名为VirtualHost的选项,均需修改。

第一个在107行左右。

在110行左右,将其中的SSLCertificateFile改为:Apache所在目录/conf/ssl/server.crt

在111行左右,将SSLCertificateKeyFile改为:Apache所在目录/conf/ssl/server.key

在112行左右,将DocumentRoot改为你的服务器根目录

在126行左右,将CustomLog改为:Apache所在目录/logs/ssl_request.log,这个不改的话也会错。一般会出现如下错误:

Apache2.2服务由于下列服务特定错误而终止:函数不正确。

改成的效果:

阅读剩余部分

相关阅读 >>

电脑提示windows已遇到关键问题怎么办

解决windows访问linux的vsftpd(ftp服务器)出现的权限问题

win10如何把索引文件windows.edb移到非系统盘?

怎么强行关闭当前程序窗口

win10屏幕出现错位重影怎么办

windows系统下的定时关机命令是什么

win10睡眠快捷键是什么

windows电脑自动断电重启是什么原因

windows是什么类型的操作系统

借助windows定时任务删除指定目录文件

更多相关阅读请进入《ApacheHaus》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...