Setup APACHE2 – “localhost”

Well i had developed a curiosity these days on server scripts especially PHP & MySQL. I coded them and essentially had to transfer them to a remote server and test it online. I found this way of testing really long and torturous. There i decided to make a server out of my own computer and setup a "localhost". Apache provides a very handy software to setup your own personal localhost sever. It essentially means that you have made a server out of your computer. Point to note is that it will not work like the orthodox servers that are available on the internet. It will just locally enable you to run your server scripts (scripts that will work only on server and not on your normal computer).

Apache2 gives away a smooth running software to set your localhost.You will understand it better if i say that, once you setup your local host you will see a valid page if you type "http://localhost/" even when your internet connection is off. well and the localhost will point to many directories within its root directory and you can address a file namesd TEST.HTML within the local directory as "http://localhost/test.html" . Well this is it about html which will run on a normal computer imagine it being test.php instead of test.html then the php will not run on your computer before you setup apache.. Once you setup apache then you be able to run the PHP(WIth few more aditional changes beyond just apache) in your computer a s "http://localhost/test.php" !!

HERE IS THE EXACT WAY YOU DO IT
Please download the exat version i suggest to keep all possible mistakes off. I had struggles with various version available on the internet finally to end up finding one perfect method to set it up. i had almost spent a week analysing most available methods to find the best and the easiest way to set it up.

1) INSTALL :

http://httpd.apache.org/download.cgi

Download under the option "Apache HTTP Server 2.0.58 is also available" and download the fourth option

"Win32 Binary (MSI Installer): apache_2.2.2-win32-x86-no_ssl.msi"

2) Install

When you install Apache, you'll get a prompt for "Server Information." Here is the settings I used:

Network Domain: localhost
Server Name: localhost
Admin Email: (your any email)

Recommend checking: "for All Users, on Port 80, as a Service"

Note where it is installng say "C:\Program Files\Apache Group\Apache2"

3) After installing, Apache2 automatically starts. The icon in the System Tray means it started. The icon means the "Monitor Apache Servers" is running, but Apache2 isn't started.

You can easily start/stop/restart Apache and Apache2 via that icon in your System Tray. If you get "The requested operation has failed!" error while starting apache use the "Test Configuration" shortcut in the Start Menu to find the error (if the text window pops up then closes before you can read it, your config file is fine).

4) TESTING
Now the ultimate test. To see if it's serving. Open your browser and head to: http://127.0.0.1/ or http://localhost/

If it shows the Test Page for Apache Installation you have your server software installed and running.

If YOU SEE THIS AS BELOW THEN YOU HAVE SUCCSFULLY SET THINGS UP

Note that this is the index file in the location "C:\Program Files\Apache Group\Apache2\htdocs". Goto this location and change the "index.html"to the one of your wish and see it reflect when you goto "http://localhost/"

5) TIPS
If you create a folder say "TEST" inside the htdoc then you create "server.html" insode that folder then you can access the server.html by the address "http://localhost/TEST/server.html"

I guess you got the whole concept of it and get goint o set up your own server.THe most important utility if setting up a server is to set it up compatible to PHP,CGI,MySQL and other server scripts. I will soon follow about how to set those onto your server. Keep a watch at this space

P.S:- Please not that you still are not configures to run server scripts. I'l teake you through that a bit later. As of noe you can test HTML by addressing like "http://localhost/" or "http://127.0.0.1/"

Next step: Go install PHP 

—- Madan

Advertisements

7 thoughts on “Setup APACHE2 – “localhost”

  1. Thanks for this, I’ve done that already but it was nice to see someone else do it to make sure I was doing it right.

    The biggest quandry I have at the moment is with the browser trying to connect to the internet when I type http://localhost. I’ve seen all the cack about “Untick Always dial a connection” and that isn’t relevant.

    What seems to happen is that the address is resolved for some reason even though i’ve told the system to work offline and definately got it setup in my hosts file fine.

    You should cover this or provide an explanation if you know it. There’s a lot of people asking about it without any clear answers. It’s easy to test because if I turn off the internet connection the localhost is really quick and everything works fine. But as soon as its activated, everything becomes sluggish.

    anyway, thanks again for the tutorial 🙂

  2. very nice tutorial. of course, it’s been very nice ever since ricocheting started it in 1999 and spent the last 9 years maintaining … for who liked these tutorials, you might want to thank the Original Author

  3. OK.. I am setting up Apache (etc.) to render php docs.

    Apache says it is running and OK (perlog) .. but http://localhost I get “Failed to Connect”.

    I.E. and Firefox … “Firefox (IE) can’t establish a connection to the server at localhost.
    I set domain and server name to localhost
    Took all other recommended check boxes
    Set path to my web docs folder (no change here)

    I’m running Windows Server 2003 / SP2

    I used apache_2.2.13-win32x86-no_ssl.msi

    So far as I can tell .. everything else works. Yes, I’m new to Server 2003

    Help Greatly appreciated

    Take Care,

    PB

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s