1. Download Apache
Go to this site-http://httpd.apache.org/download.cgi
Select either
- Win32 Binary without crypto (no mod_ssl) (MSI Installer): httpd-2.2.19-win32-x86-no_ssl.msi [PGP] [MD5] [SHA1]
- Win32 Binary including OpenSSL 0.9.8r (MSI Installer): httpd-2.2.19-win32-x86-openssl-0.9.8r.msi [PGP] [MD5] [SHA1]
and download it
2. Install Apache from the installer
By default, Apache is installed here – C:\Program Files\Apache Software Foundation\Apache2.2
3. Test it
Open a browser, and type – http://localhost
It should show the line – ‘It Works’
You are currently seeing contents of this file-
C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.html
C:\Program Files\Apache Software Foundation\Apache2.2\htdocs is the document root directory for Apache
How to set up a different root directory for Apache
1. Create a new directory.
I have created a new folder under c drive called wwwroot
C:\wwwroot
Create an index.html file under wwwroot. This is the contents of the index.html file
[sourcode]
<head>
<title>Apache Root</title>
</head>
<body>
TESTING APACHE NEW ROOT
</body>
[/sourcecode]
2. Change document root in httpd
Go here – C:\Program Files\Apache Software Foundation\Apache2.2\conf
and open this file – httpd
Change the following items there-
replace this line
DocumentRoot “C:/Program Files/Apache Software Foundation/Apache2.2/htdocs”
with this-
DocumentRoot “C:/wwwroot”
Also replace this line
<Directory “C:/Program Files/Apache Software Foundation/Apache2.2/htdocs”>
with this –
<Directory “C:/wwwroot”>
3. Restart Apache
Go to Start -> Programs -> Apache HTTP Server 2.2 -> Control Apache Server -> Restart
4. Test it
Open a browser and type – http://localhost
It will show the new index.html page
TROUBLESHOOTING
************************
Forbidden
You don’t have permission to access on this server.
Make sure that both these lines point to the same document root
<Directory “C:/wwwroot”>
DocumentRoot “C:/wwwroot”
—————————————————————————————————
Apache fails to start
Make sure, both these lines are uncommented
<Directory “C:/wwwroot”>
DocumentRoot “C:/wwwroot”