Test Port 80
issue
command netstat -ano on command prompt if you see any like like shown
below it means that port 80 is already occupied and not available for
new webserver. Port 80 is used for webservices and generally used by
IIS (Internet Information Server, a Web server that comes with
Microsoft Windows, or some time my be used by services like Skype or
some antivirus) make sure that port 80 is free before you start
installing/configuring Apache as a webserver.
Proto Local
Address Foreign Address State PID
TCP 0.0.0.0:80 0.0.0.0:0
LISTENING 8848
Download
Apache
Apache
is a free and open source webserver available for almost all
available operating systems. Apache (Webserver) is one of the
component of WAMP Server or XAMPP used by many of us for working with
php or any other opensource server side programming language. To
install Apache (sometimes referred as httpd) we need to download it
from its official website http://apache.org/
but that installation my be tedious so alternative we can download
windows binary (since we are going to setup apache on Windows) from
Apache Lounge from link http://www.apachelounge.com/download/.
Prior to installation of apache make sure that you have Microsoft’s
Windows C++ runtime already installed on your system. Just download
and install Windows C++ runtime from
http://www.microsoft.com/downloads/details.aspx?FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&DisplayLang=en
just in case you are not sure, I assure that this step wont harm in
any ways ;) .
Setup and configure Apache
Apache
files are downloaded as zip file, extract zip file to c:\apache
(or any other folder that you find suitable, I installed it on
d:\apache24), wait, let me tell you that
there was a folder named apache24 in zip file, thats the folder that
is needed to be extracted. Fig x.x shows the content of the folder.
Once
you have extracted the apache24. You need to open conf folder and and
locate the file httpd.conf and open it in your favorite text editor.
- On line 37 modify the location of server root (in my case the this like says : Define SRVROOT "d:/Apache24")
- Check for Listen directive is set for listen on port 80 (simply search for term listen in this file. In my case the directive is present on line No 60). you may specify some other port in place of 80 in case you are unable to figure out which service has occupied port 80 or just in case you don’t want to stop/terminate that service you can use port 8000, 8080, 8800 or 8888 These are some preferrerd port for web services other that port 80. but keep in mind, in case you any other port you will have to use this port number while accessing webservice through web browser e.g. if you have configured port 8080, you will have to visit http://localhost:8080.
- Search for
section and modify AllowOverride none to AllowOverride All
in all the locations within this file. - Search for DocumentRoot "${SRVROOT}/htdocs", remember that you have set the SRVROOT in first step here you are saying that document root is htdocs folder on your serverver root. This is the location where you will be required to put all you webpages, or php files to be accessed through internet (browser).
- Save this file (httpd.conf).
Test and start Apache Web Server
On
terminal (command prompt) go to bin folder under apache24. (you will
need to enter some DOS Commands, ask me if you want to know the
commands.) and issue httpd
-t to test httpd.conf. This command will display errors,
if no error appears, it means that you are ready to start your web
server. Now just issue following command on terminal to install
apache as a windows service (which will automatically starts whenever
you start your computer.
httpd -k install
To
check if server is working fine, open your favorite web browser and
type localhost on its address bar then hit enter. If you see “It
Works” on your browser, it means that you have successfully
installed apache on windows machine.
You
can also access your webserver using http://127.0.0.1
or using http://IPAddressOfMachine
from any computer on network.
Although
when you install apache using httpd -k install command, apache gets
added to windows service which can be managed using services.msc. You
can set apache service to start automatically whenever system boots.
Next
Article will be installing PHP on Windows and run it through Apache
webserver.
No comments:
Post a Comment