http://httpd.apache.org/download.cgi
httpd-2.4.12-win64-VC11.zip将其放到自己的安装目录(我的目录D:/Programs/Apache24)
Binaries built on Visual C++ 2012 x64 do not run on Windows XP or Windows Server 2003
These binaries were built with Visual Studio� 2012 x64, be sure to install the required Visual C++ 2012 x64 Redistributable Package, download from;
http://www.microsoft.com/en-us/download/details.aspx?id=30679
(Apache24\conf\http.conf)配置文件进行修改-使用记事本打开就行
(1)修改ServerRoot Apache的根路径:
(38行)ServerRoot"/Apache24"改成=>ServerRoot "D:/Programs/Apache24"
(2)修改ServerName你的主机名称:
(220行)ServerName localhost:80将前面的#去掉,该属性在从命令行启动Apache时需要用到。
(3)修改端口Listen(我这边80端口呗占用了,所以修改成了7070端口)
(60行)Listen 80→Listen7070
win+x,选择“命令提示符(管理员)”。接着进入D:\Programs\Apache24\bin目录下
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 |
打开IE,然后在地址栏输入:"http://localhost:7070" 或者 "http://127.0.0.1:7070" 可以看到Apache安装完成的成功页面;以后网页的存在位置就在 "D:/Programs/Apache24/htdocs" 目录。进入下面的界面:
打开电脑 “开始”->“运行”-> cmd,进入DOS命令行窗口,进入Apache安装目录,如 D:\Programs\Apache24\bin目录。(使用管理员权限)
输入命令:httpd.exe -k uninstall 卸载Apache服务。(注:httpd.exe -k install 命令是安装Apache 服务)。
(1)
AH00369: Failed to open the Windows service manager, perhaps you forgot to log in as Adminstrator?
原因及解决:没有管理员权限,用管理员权限打开命令行就可以。
(2)
httpd: Syntax error on line 39 of D:/Programs/Apache24/conf/httpd.conf: ServerRoot must be a valid directory
原因及解决:Apache服务地址错误,修改httpd.conf的 (38行)行ServerRoot "/Apache24"中的目录为实际Apache目录,注意"/"
(3)
Errors reported here must be corrected before the service can be started.
很多人看到Errors都会想怎么启动就遇到错误啊,首先需要强调的是这句话并不是说Apache启动错误。 这句话是Apache内置的启动提示语句,暂时没有找到取消和更改的方法。
这句话英文翻译后可以理解为:
Apache每次启动都会检测配置文件httpd.conf有没有错误,如果在Errors reported here must be corrected before the service can be started.这句话下边出现提示或错误时必须先把这些问题解决了才能成功启动Apache服务。
所以大家看到Errors reported here这句下边没有任何提示则说明Apache启动很成功!可以放心进行其他相关操作。