Guide: Setting up a local server

Bahawolf1

Fully Optimized
Messages
2,605
Location
United States
This guide is to discuss how to set up a server on your local computer. Please be aware that some Internet Service Providers (ISPs) will have policies against running a server from your connection. I advise you to to refer to the TOS of your ISP before doing this, or you may be disconnected from your service.

How do we begin?
To begin, the first thing that we need to download is an application called Apache. Apache is a server client that will run the neccassary processes to let the core of your server operate. Installing apache is rather simple, but I will walk through the installation of Apache to be helpful.

You may begin by downloading Apache from:
http://httpd.apache.org/download.cgi

We shall download Apache HTTP Server 2.0.55 because it is a stable version of Apache (as of April 6th, 2006). If you view this article in some time from now, Apache may have a newer version out. -- I reccomend to download the latest version from the website for increased security, and greater functionality.

Unfortunately, the Apache organization has not made a Win32 Binary (installer) application for Apache HTTP Server v2.2.0 yet, so we will use v2.0.55 to make it easiest on ourselves.
http://government-grants.org/mirror...ries/win32/apache_2.0.55-win32-x86-no_ssl.exe

Going through the installation is rather simple, until you get to entering the 'Server Information', where you'll need to manually enter information. It is just basically server configuration options, and you may use the following:

Network Domain (e.g. somenet.com): localhost
Server Name (e.g. somenet.com): localhost
Administrators Email Address (e.g. webmaster@somenet.com): Your email address

Then we'll select “for All Users, on Port 80, as a Service –- Recommended”. This will start Apache as a service and run it automatically when the system reboots. This would be the best solution for users that want something quick and simple, no maintenance needed.

Instead of selecting 'Typical' for the Setup Type, select 'Custom' because we're going to keep everything in an organized folder for you.

From the next window that appears, select “Apache HTTP Server” and click on the “Change…” button located in the bottom right.

This will bring up another window, where we're going to change the default installation folder. To keep everything very simple, I'd reccomend changing the default install directory to something like: C:\Server\ -- Whatever you use, remember the ending backslash. Click Ok and then Next.

Apache should begin to install, and a few moments later it'll be done.

Now we can test to see if Apache is installed and running correctly. Open your favorite browser, and give it a try. Simply type in http://localhost/ as the URL and hit enter. If you see a page generated, the install was successful and you may continue.

Remember that we setup Apache to run as a service so the only time the server needs to be stop or restarted is when changes to the httpd.conf file are made. This file contains all the configurations for the server and in most cases doesn't need to be edited as this application will pretty much work out of the box, so to speak.

Now we can edit and add pages to our new server by going to “C:\Server\Apache2\htdocs\”. This will be where all the web pages will be located and should be stored. This can be changed by configuring the location in the httpd.conf file. Remember to restart if anything is changed within this file.

To restart apache, you may go to the following:
Start>All Programs>Apache HTTP Server 2.0.55>Control Apache Server>Restart
That will restart your apache server, and load any changes done to httpd.conf.

By the way, to change any settings manually in httpd.conf (such as the port Apache runs on), the file is located in "C:\Server\Apache2\conf\". Please remember to restart Apache after making changes.
 
Now, lets move on to install MySQL Server so that you can hold and run mySQL databases with your server. The download link for the latest mySQL Server (currently version 5.0 Community) is:
http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.19-win32.zip/from/pick#mirrors

From there, you can pick a mirror to download from.. and we'll continue once your done downloading that.

Okay, unzip the file that you've just downloaded and open 'setup.exe'. You can just click 'Next' on the first screen, but when it comes to the Setup Type screen, select Custom because this time we're going to make some custom requests of the installer.

The next screen we're going to come to will be allow us to select the features we'd like to install in this session. We'll leave this alone as its all setup correctly for what we're trying to do.

We will need to change the location for the installation, so we'll just select MySQL Server and then click on the Change button located in the bottom right.

Simply type in the location of your other files, in this case we'll use “C:\Server\MySQL” as this is where the rest of our server applications are being installed. Then click on Ok.

This will change the installation location for the rest of the features, so there isn't any need to change them. Simply click on Next from here.

Once you begin to install, sit back because its going to take a couple minutes.. After its complete installing, it'll ask you to sign up for mySQL.com for updates and such.. you can skip it for now.

ow we get to configure the server to run the way we'd like for it to run (Make sure that 'Configure the mySQL Server now' is checked).

On the next screen that appears, you can press Next. We'll want to select Standard Configuration from the next screen. Remember this is for new installations of MySQL. Users that already have MySQL installed and are upgrading, please select Detailed Configuration.

Continue, and press Next.

Now we get to make a few choices about our server, for this guide we'll use “Install As Windows Service” and make sure “Launch the MySQL Server automatically” option is checked. This will insure the MySQL server is started if it ever shuts down, or the system ever restarts.

Next we'll need to select a root password, simply type a password you'd like to use for root access and let's write it down so we don't forget it. Also remember to check “Enable root access from remote machines”. This will insure we can edit anything if needed from a remote location later on.

The next screen is simply the start screen for the configuration utility, letting us know what it's about to perform. Simply click on Execute.

Once we've finished the install we can check to make sure that MySQL is installed and working properly. Find the folder in the start menu where MySQL is located and launch the “MySQL Command Line Client”.

Once this is open simply enter the password we just set and if the client allows access with no errors, MySQL is now installed and working properly. There is no need to leave this command line client open, simply type “exit” and enter. This should close the client out.

mySQL is now installed.. we'll move on to PHP next.
 
Okay, so we're going to begin by downloading PHP from:
http://www.php.net/get/php-5.1.2-installer.exe/from/a/mirror

Pick a mirror, and download it and we'll continue once your finished.

Okay, lets begin.
Open up the installer and begin by clicking Next.
The next screen is the License Agreement.. Simply click on I Agree and we'll continue to the next step.

Here we'll want to select Advanced as we're not installing anything in the default location we're organizing everything a little bit more and installing all of our server applications in a sub folder of a main Server folder.

The next window brings us to the installation directory that PHP will be installed in. We're going to want to click on Browse.

In this case we're going to use “C:\Server\PHP” as the installation directory, once this has been typed in the location bar simple click on Ok.

Next, you hit Next...
For the screen about the backups, make no changes and hit Next.

The next screen will ask us about the temporary upload folder. Leave it be, because we don't need it in the server folder, and hit Next.

Leave the next screen as well, and hit Next.

The next screen is for the SMTP server. Sense we haven't setup one yet, we'll leave this all as the default and we can go back later and change it at any time by editing the php.ini file.

For the next screen asking about error reporting, select the one best for development.

On the next screen, select Apache in this case and click Next.

For the extensions, leave it default and click Next.

If it asks about keeping a PHP.INI file, select No.

We'll be setting PHP up as a CGI binary as it's the simplest to setup and get us moving quickly.

Now we'll need to edit the httpd.conf file, which is located in the conf folder on Apache2 installations. Once the httpd.conf is opened we'll need to add a few lines of code to the very bottom of this file to allow PHP to load and work correctly.

ScriptAlias /php/ "c:/server/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"

The first line will let Apache know the installation of PHP and the next two will let Apache know how to handle PHP files. Once the following code has been added to the httpd.conf file, simply restart Apache and if no errors are displayed we're pretty much finished. But we'll make sure PHP is installed correctly.

Open a text editor and put the following code in it:
<?PHP phpinfo(); ?>
Save it as phpinfo.php and put it in C:\Server\Apache2\htdocs and load it up at: http://localhost/phpinfo.php

As long as it comes up, PHP is good.


Okay, so now that we have a basic server running, we'll setup a link for ourselves. As always, you can link to your server through an IP, but if your IP changes or whatever, then you need to change the link..
Also, please note that you will NOT be able to connect to your own local server from anywhere in your network, using your own IP.

I'd reccomend going to http://no-ip.org and registering for a DNS Host, and then downloading the client to keep your IP up to date with the DNS settings.

Good luck, and I hope someone enjoyed this guide.
 
Back
Top Bottom