I think I should try to make a post daily, if possible, about my exploits.
Today I cobbled together a USB-Portable web server, so I think I’ll tell you about that.
Previously I’ve been using XAMPP Lite. But, I disliked it as a Portable web server for a number of reasons:
- It is big. 63mb after UPX.
- It has a bunch of things I don’t need or will ever use, and just take up space.
- I am limited in my ability to update the individual servers… I am tied to XAMPP’s update schedule.
- Sometimes when a new release is released there’s no update installer, so I have to carefully be sure I don’t overwrite my customized CONF files.
- I could never get MySQL to not use absolute paths for its stuff, not good for portability (eventually, as I note below, I figured out you never need to put any paths in at all).
So I decided to make Mega-Zerver, for my personal use, which sports the following featureset:
- Apache HTTPd 2.2.3, with OpenSSL add-in for HTTPS support.
- PHP 5.2.0, which luckily for me is the first version with Apache 2.2.x support. Hurray for no planning! :v I tweaked some settings, including loading MySQL and GD.
- MySQL Community Server 5.1.14-beta Essentials, since I want the “lite”-est stuff for my portable server.
- phpMyAdmin 2.9.1.1 because I don’t know much SQL, and I love phpMyAdmin. 🙂
- UnrealIRCd 3.2.5, because I’ve always wanted an IRC server at my beck and call on a USB drive! As I’ve unfortunately found out, it isn’t very portable (more on that below).
- Anope 1.7.17, everybody’s favorite services for IRC.
- Everything is again compressed with UPX using the –best switch. It all weighs in at about 40mb.
If you want to make your own, there’s some things to be aware of in the list below. Of course, before embarking on such a quest, you should be knowledgeable in the operation of said servers already and be able to edit their configuration files comfortably.
- Apache doesn’t like relative paths (using .. to go up a directory) BUT you can avoid using absolute paths by leaving off the drive letter: \Programs\Internet\Mega-Zerver\Apache
- The above works for all the servers except for MySQL. It only accepts absolute paths… fortunately all the settings which take paths are entirely optional so I left them out.
- If php_mysql.dll is not loading as a PHP module even though the path is correct, copy libmysql.dll to Apache’s bin directory, restart Apache, and everything will magically work. I remember having to do this before I found XAMPP, took me FOREVER to figure out why the module wasn’t loading.
- You can specify a shared temp directory for PHP uploaded files and sessions. Unfortunately UnrealIRCd does not allow you to change its temp directory.
- You may wish to turn off or turn down logging options in all servers.
- MySQL’s my.cnf does NOT go in the MySQL\data directory or the MySQL\bin directory, which is odd because the docs say data, and XAMPP uses bin. Just stick it in MySQL\.
- When configuring MySQL, use the my-small.ini as a base. Also turn off InnoDB, because the default InnoDB settings eat up 20mb disk space with an empty server. Or you can adjust the space settings if you wish. There is a directive to change the “autoincrement” size you will want to declare if you do so.
- Apache will not have SSL support built in. If you want it, don’t bother with the official Apache site. Instead, grab a pre-built package here, which contains all the files in the right places. Then, read this guide, but note that the package you have already has all of the stuff in #1 and most of #2 done for you. So start reading the paragraph right before #3 and continue from there to set everything up.
- phpMyAdmin has a kickarse config script I never saw before. To use it, make a /config/ dir under the phpMyAdmin dir, and make sure the Apache/PHP user can write to it (in Windows this is usually always true, yay for security D:). Then load up http://your.server/pathToPhpMyAdmin/scripts/setup.php for a sweet automated setup thing I don’t remember being there before. You’ll probably just want to add one server… just remember to hit Save at the bottom of the main page when you’re done.
- Also note that, if you don’t have a config file made yet for phpMyAdmin, its index page might tell you PHP doesn’t have mysql loaded even if it is. Just check to see if you forgot about the config.
- UnrealIRCd can only run as a service… which really sucks for portability. A poor workaround is to install it, start it, and then stop and uninstall it when you’re done. I tried this a couple times and found an annoying Windows “feature” (read: bug). I’m not sure what caused this instead of the normal behavior, but I deleted the service but it didn’t get… deleted. Instead it was “marked for deletion” and any attempt to interact with it produced such an error, which didn’t go away until I rebooted. Grr.
- I couldn’t get MySQL to launch unless I passed it –console. Weird. Maybe it’s UPX’s fault… I really didn’t test much to see if it was or not.
- Anope will not launch unless its working directory is the path of the EXE. I call poor coding. 🙁
- Anope dumps copies of modules into modules\runtime. You should delete these every so often (except the ones it has loaded of course, which will be locked) because they can quickly eat up a lot of space if left alone. This applies to any log files you let any of the servers generate, as well.
Happy serving. 😀
1 response so far ↓
1 Breyhana-Ariel // Mar 12, 2009 at 3:04 pm
I’m currently using XAMPP but I want to a custom portable server I know how to use all features I want and how to configure I just don’t know the process of making it portable. How did you make Mega Zerver portable?
You must log in to post a comment.