How to run a portable web server

Want to demonstrate a test site or simply try something out? Having a server on your own PC or even on a USB stick is a great boon.


A huge variety of web services and providers are available, ranging from free online site builders to fully configurable virtual servers hosted by an ISP. For a large number of these, you'll be able to log in and create your website fairly easily, so why would you need web server software?

For a web developer, the advantage of having a server on your own PC is that you can test pages and sites before they go live. In particular, if you're working with complex scripts or plug-ins, there's always a danger that they may cause your site to stop working or create vulnerabilities.

Server2Go, which we demonstrate in the following walkthrough, can be installed on a USB drive. This means you can take your files with you wherever you go, and use them even on a PC where you have no administrator privileges and are unable to install any programs. This will be useful if you want to demonstrate a test site to someone else or simply try something out.

It's also possible to create media-rich applications that can be distributed to run from disc when you don't want them available online. If you also bundle the installation-free version of Firefox, you'll gain complete control over the presentation and distribution of your files.

Getting up and running with Server2Go

Server2Go runs without needing to install itself on your machine, which means you can launch it directly from write-protected media. Because it usually includes a fully functioning database, you can create complex applications such as catalogues and computer-based training (CBT) products that can be sent out on disc.

The program comes in a number of versions, including a micro package that consists of the web server Apache. In most cases, however, you'll want to use a version that includes PHP, MySQL and Perl to ensure you have everything you need for a fully functioning site.

Apache is the core application. The popular open-source web server could be downloaded as part of Server2Go in three different releases at the time of writing: 1.3.55, 2.0.63 and 2.2.11. The first two versions are stable but older forms, while the latter is a more recent release.

Database functions are handled by the open-source MySQL program, with which many web developers will be familiar, along with the less commonly encountered SQLite. This allows databases to be run without installation or administration. Finally, Perl and PHP are popular coding languages required to run a large number of interactive sites. PHP is particularly useful alongside MySQL for handling databases, with Server2Go supporting PHP 5.2 and MySQL 5.0.41.

It's possible to tinker around with various settings within configuration files after you've downloaded Server2Go. We'll do a little of that here in order to ensure that the program runs alongside another portable app, FirefoxPortable.

In general, however, one of the best features of the package is that it runs effectively and efficiently with no further requirements on your part.

STEP 1. Download the Server2Go software from Click Downloads and select a version. We recommend the most complete package, but you can opt for a download of between 6MB and 45MB.

Download Server2Go

STEP 2. Server2Go downloads as a self-extracting .zip file. Double-click this. Once its contents have been extracted into a new folder, have a nose around and familiarise yourself with the various folders.

You'll find an icon that launches the program and six folders. Server contains the applications that will run your web pages, dbdir handles databases and cgi-bin stores executable scripts. See Using phpMyAdmin (below) to learn about the Admin folder. Htdocs is the most important folder: this is where you'll store the web pages you create.

Familiarise yourself with Server2Go's contents

STEP 3. To begin using Server2Go immediately, double-click the main icon to launch the web server. This will open your web browser with the address - a test page that confirms you've unzipped the package correctly. To open any other files in your htdocs folder, type the name of the file after the localhost address. Closing the browser will shut down the server.

You have correctly unzipped the package. Well done.

STEP 4. In the next few steps, we'll show you how to create a truly self-contained system using the portable version of Firefox available from Having downloaded a copy, double-click the .zip file to extract its contents into the folder that contains your server software. There, you'll find a folder called FirefoxPortable; double-clicking the icon within this folder will launch the application.

STEP 5. You'll need to make a few configuration changes if you want to use Firefox as the default browser. First, go to the folder FirefoxPortable\App\Firefox and change the name of the icon Firefox.exe to ffp.exe. Don't change the name of the icon FirefoxPortable in the top directory. Instead, create a file called FirefoxPortable.ini and add the following code in the directory FirefoxPortable\:


Enter Firefox code

STEP 6. Finally, in the Server2Go folder, open the file pms_config.ini and find the line that begins BrowserType. Change this from BrowserType=IEXPLORER to BrowserType=PORTABLEFIREFOX, and the line BrowserPath=ExternalBrowser/SimpleBrowser.exe to BrowserPath=FirefoxPortable/FirefoxPortable.EXE (this assumes that you unzipped FirefoxPortable into the server that hosts the rest of your Server2Go files).

Firefox will now launch as the default browser, allowing you to design pages without worrying about what software is installed on the end-user's PC.

Using phpMyAdmin

Setting up and managing SQL databases is a complex task when completed via the command line, so the close integration of MySQL and PHP in phpMyAdmin comes in incredibly useful.

This is bundled as a standard part of the Server2Go package. You can access it from your web browser by typing phpMyAdmin after the address of your local server ( From here, you'll see the splash screen with some basic information about the version of MySQL being run on your machine, as well as a drop-down menu of databases in the left-hand panel.

Selecting one of these databases will display it in the main window, where you'll see a list of tables contained within. Tabs let you sort information, export or import records, create new tables via operations or edit privileges to restrict access.

To create a new database in phpMyAdmin, locate the field entitled 'Create new database' that sits about halfway down the home page. Enter the name of your database and click Create.

Next, you'll be asked to create a table with a number of fields. You can then specify the name, type and any default values contained in those fields.

"Recommended For You"

Top MySQL performance tips Windows 7: How to upgrade from XP