Open url https://www.apachehaus.com/cgi-bin/download.plx using your browser.
Choose a version to download,here we use Apache 2.4.x OpenSSL 1.0.2 VC14
- Apache 2.4.41 x64
we will get a file named httpd-2.4.41-o102s-x64-vc14-r2.zip
VC14 means it's compiled by Visual Studio 2015
,So download
Microsoft Visual C++ 2015 Redistributable Package (X86 & x64)
at the bottom of page.
httpd-2.4.41-o102s-x64-vc14-r2.zip
to a folderD:\readme_first.html D:\Apache24\ D:\Apache24\bin
Microsoft Visual C++ 2015 Redistributable Package (X86 & x64)
if your windows does not have Visual C++ 2015 installedEdit the file D:\Apache24\conf\httpd.conf
Define SRVROOT "d:\Apache24" # ServerRoot "${SRVROOT}" ... ... #Listen 12.34.56.78:80 Listen 80
We will put our scripting files in the DocumentRoot
folder.
that is d:\Apache24\htdocs
Line 38: Define SRVROOT "d:\Apache24" Line 39: # ServerRoot "${SRVROOT}" Line 248: DocumentRoot "${SRVROOT}/htdocs" Line 249: <Directory "${SRVROOT}/htdocs">
Open a command prompt window, type:
C:\WINDOWS\system32>cd /d D:\Apache24\bin D:\Apache24\bin>httpd.exe
Open up your Web Browser and typing in the address:
http://localhost
create a new file d:\Apache24\htdocs\hello.html
<html> <head><title>hello</title> <body>Hello Apache!Lautturi.com</body> </html>
To run Apache as a Windows Service, in the command prompt type:
D:\Apache24\bin>httpd -k install Installing the 'Apache2.4' service The 'Apache2.4' service is successfully installed. Testing httpd.conf.... Errors reported here must be corrected before the service can be started. D:\Apache24\bin>httpd -k start
if you use win10,open the command prompt window using keyboard WIN+X,Press Windows+X to open the Power Users menu,then choose Command Prompt(Admin)
Command line | Desc |
---|---|
httpd -k install |
Install Apache as a service |
httpd -k start |
Start Apache service |
httpd -k stop |
Stop Apache |
httpd -k restart |
Restart Apache |
httpd -k uninstall |
Uninstall Apache Service |
D:\Apache24\bin>services.msc
there would be a service named 'Apache2.4'