Windows下 Apache的安装以及简单配置

  1. Apache的下载:

进入apache服务器官网 http://httpd.apache.org/ 比如我要下载 Apache httpd 2.4.18 Released 2015-12-14这个版本 选择Download

然后选择Files for Microsoft Windows 之后会看到以下内容: The Apache HTTP Server Project itself does not provide binary releases of software, only source code. Individual committers may provide binary packages as a convenience, but it is not a release deliverable.

If you cannot compile the Apache HTTP Server yourself, you can obtain a binary package from numerous binary distributions available on the Internet.

Popular options for deploying Apache httpd, and, optionally, PHP and MySQL, on Microsoft Windows, include:

ApacheHaus Apache Lounge BitNami WAMP Stack WampServer XAMPP

意思大概就是Apache HTTP服务器项目本身并不提供软件的二进制版本中,只有源代码。如果自己不能编译可以从互联网中获取,吧啦吧啦… (当然了BitNami WAMP Stack、WampServer、XAMPP是不是很熟悉的感觉呢? 这里我们可以选择ApacheHaus进行zip包的下载:

然后我们选择想要的版本下载就Ok了

  1. 安装以及配置

解压刚刚下载好的zip包,放置在一个目录下(如D:\Apache24 (接下来我为了偷懒,直接搬运readme_first.html里的说明了 Installation

You must first install the Visual C++ 2008 Redistributable Package. Download and Install, if you have not done so already (see URL above)

Unzip the Apache24 folder in the package zip file to the root directory on any drive. This is the “ServerRoot” in the config. Example: c:\Apache24

To test your installation;

Open a command prompt window and cd to the \Apace24\bin folder on the drive you unzipped the zip file to.

To Start Apache in the command prompt type:

httpd.exe Press Enter. If there are any errors it will tell you. Warnings will not stop Apache from working, they do need to be addressed none the less. If there are no errors (there shouldn’t be, but it happens) the cursor will sit and blink on the next line. So far so good.

This distribution comes pre-configured for localhost. You can now test your installation by opening up your Web Browser and typing in the address:

http://localhost If everything is working properly you should see the Apache Haus’s test page.

You can shut down Apache by pressing Ctrl+C (It may take a few seconds)

To Install Apache as a service:

In most cases you will want to run Apache as a Windows Service. To do so you install Apache as a service by typing at the command prompt 1;

httpd -k install You can then start Apache by typing

httpd -k start Apache will then start and eventually release the command prompt window.

1 You have to run the command prompt as Administrator in Windows Vista/7/2008/8/8.1/10/2012/

Other Command line options:

Stop Apache httpd -k stop Restart Apache httpd -k restart Uninstall Apache Service httpd -k uninstall Test Config Syntax httpd -t Version Details httpd -V Command Line Options List httpd -h

简单说明一下 管理员身份运行命令提示符: 进入D:\Apache24\bin

然敲命令httpd -k install后将Apache注册为系统服务

如图已经安装好了,但是有一个错误,这个需要后续的配置了。 我们可以在服务里面看到已经有了Apache了:

Licensed under CC BY-NC-SA 4.0
最后更新于 Jun 07, 2016 20:42 UTC