Windows Apache2.4 VC9(ApacheHaus)详细安装配置教程
作者:mdxy-dxy 发布时间:2023-08-05 16:43:22
1,Apache下载 https://www.apache.org/
选择一个版本,点击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程序的文件夹,例:
ServerRoot "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22"
找到Listen选项,设置端口,大约46行,一般不修改,使用默认80,在开启服务器前请保证80端口未被占用
找到DocumentRoot选项,修改服务器根目录,例:
DocumentRoot "F:/"
请保证此目录存在,否则服务器无法正常启动
修改Directory,保证其与服务器根目录相同,只修改下面的第一行中引号部分
<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文件夹
ScriptAlias /cgi-bin/ "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/cgi-bin"
找到随后的Directory选项,设置脚本目录,大约342行,需要将其设置为和前面的ScriptAlias目录相同
<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服务由于下列服务特定错误而终止:函数不正确。
改成的效果:
<VirtualHost _default_:443>
SSLEngine on
ServerName localhost:443
SSLCertificateFile C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/conf/ssl/server.crt
SSLCertificateKeyFile C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/conf/ssl/server.key
DocumentRoot F:/
# openssl req -new > server.csr
# openssl rsa -in privkey.pem -out server.key
# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 2048
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/Apache22/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</virtualhost>
主要改上文四处地方
在130行和152行还有另外两个VirtualHost,均需修改上述的四个选项
例:
130行
<VirtualHost *:443>
SSLEngine on
ServerName serverone.tld:443
SSLCertificateFile C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/conf/ssl/serverone.crt
SSLCertificateKeyFile C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/conf/ssl/serverone.key
DocumentRoot F:/
# openssl req -new > serverone.csr
# openssl rsa -in privkey.pem -out serverone.key
# openssl x509 -in serverone.csr -out serverone.crt -req -signkey serverone.key -days 2048
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/Apache22/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" env=HTTPS
</virtualhost>
第152行
<VirtualHost *:443>
SSLEngine on
ServerName servertwo.tld:443
SSLCertificateFile C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/conf/ssl/servertwo.crt
SSLCertificateKeyFile C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/conf/ssl/servertwo.key
DocumentRoot F:/
# openssl req -new > servertwo.csr
# openssl rsa -in privkey.pem -out servertwo.key
# openssl x509 -in servertwo.csr -out servertwo.crt -req -signkey servertwo.key -days 2048
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/Apache22/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</virtualhost>
上述的两个VirtualHost均需修改四处
这样,Apache就算配置完了,如果还有问题,可能还需配置./conf/extra/httpd-ssl.conf,配置方法和配置VirtualHost的相似
4,启动Apache HTTP Server
使用Windows命令行以管理员身份进入Apache程序的文件夹下的bin文件夹,输入httpd -k install,完成Apache服务的安装。
然后双击bin目录下的ApacheMonitor.exe,点击右边的start启动服务器,如果正常,如下图:
测试一下:
5,其它
卸载Apache HTTP Server:
管理员身份进入bin目录,使用httpd -k uninstall 移除服务
使用httpd -w -n "Apache2" -k start命令启动服务器 可以显示启动过程中的日志,便于分析错误。
来源:http://www.cnblogs.com/xyb930826/p/5444718.html
猜你喜欢
- 如果你经常上网,想必对代表90后特点的火星文多少有些了解。因为现在的网络上,无论是论坛、游戏还是QQ签名里,到处都可看到这些让人有点头晕目眩
- 对于专有软件使用者来说,当需要升级到一个新版本的时候,并没有多少激动的感觉。因为这种升级通常是为一些补丁修复或微小的功能升级来掏钱买单。即使
- Siege是一个多线程http负载测试和基准测试工具。通过使用Siege 提供的功能,可以很容易的制定测试计划:包括规定使用并发用户数、重复
- 阿里云服务器ping不通解决办法(云服务器搭建完环境访问不了ip解决办法)问题:这里的服务器我以阿里云为例,学生套餐嘛,便宜,最近搞服务器,
- 1、在ubuntu官网下载ubuntu16.04的镜像和对应ubuntu16.04的内核版本源代码,或者在镜像源上找2、安装ubuntu16
- 维护Web服务器安全是信息安全中最不讨好的差事之一。你需要在相冲突的角色中找到平衡,允许对网络资源的合法访问,同时阻止恶意破坏。你甚至会考虑
- 大家在使用GoDaddy主机时,常会遇到一些棘手的问题,下面给大家参考一些疑难解答,希望对大家有帮助。为什么图标目录里的文档显示不出来? 在
- 在Exchange 2007组织环境中,我们可以在三个层面对消息大小进行限制,组织级别(Global Settings)、服务器级别、连接器
- 11月4日消息,针对旗下游戏新作《绿色征途》自封国内首款绿色网游惹争议一事,巨人网络今日发表回应称,绿色网游应重视玩家利益。据悉,巨人网络为
- 由SiteServer CMS、中国站长站联合主办,中电数据、创意在线协作举办、站长 * 别支持的“2010,我爱SiteServer CMS
- 距北京奥运会开幕不到一个月,奥运比赛的绝大部分赛程均已敲定。16天跌宕起伏的赛事充满了令人眼花缭乱的看点,为了方便读者找到每天比赛的重点,我
- “冲击波”等蠕虫病毒特征之一就是利用有漏洞的操作系统进行端口攻击,因此防范此类病毒的简单方法就是屏蔽不必要的端口,防火墙软件都有此功能,其实
- 北京时间9月30日消息,据科技博客iLounge日前报道,消息人士透露苹果计划在2010年1月19日或者之前宣布其平板电脑,该消息人士还透露
- 从PHP5.2.10版本开始(现在有PHP5.2.10和5.3两个版本),有None-Thread Safe与Thread Safe两种版本
- 自从做卖站以来,遇到的形形色色的人,真是林子大了,什么鸟都有,现在我列出以下几种人,希望卖站新人能从中吸收到一些经验:1)没看清楚卖站的说明
- Kafka(http://kafka.apache.org/) 是由 LinkedIn 使用 Scala 编写的一个分布式消息系统,用作 L
- 前言安装的VMware是 VMware Workstation 16 Pro安装的映像文件是Centos 7 64位的第一步进入官网,然后下
- VMware Workstation 是一个虚拟PC的软件,利用VMware工作站,可以在现有的操作系统上虚拟出一个或多个新的硬件环境,相当
- 安装步骤1. 安装Redis通过docker search redis和docker pull redis下载redis镜像2. 新建挂载配
- 作为企业的信息化安全人员,其主要任务就是如何在保障服务器性能的前提下提高服务器的安全性。而要做到这一点,服务器的访问权限控制策略无疑是其中的