https://wiki.uniformserver.com/index.php?title=USB_self-contained_server&feed=atom&action=historyUSB self-contained server - Revision history2024-03-28T22:08:18ZRevision history for this page on the wikiMediaWiki 1.41.0https://wiki.uniformserver.com/index.php?title=USB_self-contained_server&diff=4795&oldid=prevOlajideolaolorun: Reverted edits by Upazixorys (Talk); changed back to last version by Ric2010-11-24T08:28:33Z<p>Reverted edits by <a href="/Special:Contributions/Upazixorys" title="Special:Contributions/Upazixorys">Upazixorys</a> (<a href="/index.php?title=User_talk:Upazixorys&action=edit&redlink=1" class="new" title="User talk:Upazixorys (page does not exist)">Talk</a>); changed back to last version by <a href="/User:Ric" title="User:Ric">Ric</a></p>
<a href="https://wiki.uniformserver.com/index.php?title=USB_self-contained_server&diff=4795&oldid=4617">Show changes</a>Olajideolaolorunhttps://wiki.uniformserver.com/index.php?title=USB_self-contained_server&diff=4617&oldid=prevUpazixorys at 01:12, 24 November 20102010-11-24T01:12:30Z<p></p>
<a href="https://wiki.uniformserver.com/index.php?title=USB_self-contained_server&diff=4617&oldid=3642">Show changes</a>Upazixoryshttps://wiki.uniformserver.com/index.php?title=USB_self-contained_server&diff=3642&oldid=prevRic: New page: <span id="top"></span> {| cellpadding="2" |__TOC__||'''USB self-contained server''' |} '''Introduction''' With the release of Uniform Server V4.0-Mona thought I would revisit a self-conta...2009-02-15T09:06:13Z<p>New page: <span id="top"></span> {| cellpadding="2" |__TOC__||'''USB self-contained server''' |} '''Introduction''' With the release of Uniform Server V4.0-Mona thought I would revisit a self-conta...</p>
<p><b>New page</b></p><div><span id="top"></span><br />
{| cellpadding="2"<br />
|__TOC__||'''USB self-contained server'''<br />
|}<br />
'''Introduction'''<br />
<br />
With the release of Uniform Server V4.0-Mona thought I would revisit a self-contained server on a USB memory stick. This includes portable Firefox and a PAC file simulating a portable DNS server.<br />
<br />
This really is intended as a teaching and development server. A PAC file avoids using the hosts file. On Vista this can be a pain before it can be edited requires administrator privileges.<br />
<br />
== Components required ==<br />
The following components are required:<br />
<br />
* Uniform Server 4.0-Mona<br />
* Portable Firefox<br />
* A PAC file<br />
* A domain name I will use this address '''<nowiki>http://center.uniformserver.com</nowiki>'''<br />
<br />
== Installation ==<br />
<br />
'''''Install Uniform Server'''''<br />
<br />
# Extract Uniform Server V4.0-Mona to any folder.<br />
# Copy the entire content of folder '''udrive''' to USB root (top-level).<br />
# From folder UniServer copy '''UniController.exe''' to USB root. <br />
<br />
'''''Install Firefox Portable'''''<br />
<br />
# Download the latest version of Firefox Portable from: [http://portableapps.com/apps/internet/firefox_portable Portable Apps] save to any folder<br>(File '''Firefox_Portable_3.0.6_en-us.paf.exe)'''<br />
# On your memory stick at the top level create a new folder named '''fx3''' (choose any name you like)<br />
# Double-click on the file downloaded '''Firefox_Portable_3.0.6_en-us.paf.exe'''. When prompted select the folder '''fx3''' on your memory stick and click OK. A '''FirefoxPortable''' folder will be created and all the necessary files installed.<br />
<br />
'''''Note'':''' To run double click on '''FirefoxPortable.exe''' (located in folder *\fx3\FirefoxPortable)<br />
<br />
'''''[[#top | Top]]'''''<br />
== Create Virtual Host ==<br />
The easiest way to create a virtual host is to use Apanel however this writes to the hosts file. To avoid this edit Apache's config file and add the virtual host(s) manually.<br />
<br />
Edit file: L:\usr\local\apache2\conf\'''httpd.conf''' (Note your drive letter may be different) <br />
<br />
Navigate to the end of this file and just under the default host (localhost:80) add the new host section:<br />
<pre><br />
NameVirtualHost *<br />
<VirtualHost *><br />
ServerName localhost:80<br />
DocumentRoot /www<br />
</VirtualHost><br />
<br />
##########VIRTUAL HOST SETUP##########<br />
# CENTER.UNIFORMSERVER.COM<br />
<VirtualHost *><br />
ServerName center.uniformserver.com<br />
DocumentRoot /www/center<br />
</VirtualHost><br />
</pre><br />
<br />
I am using ServerName '''center.uniformserver.com''' and DocumentRoot '''/www/center''' use your real domain and create the appropriate folder in '''L:\www''' (again your drive letter may be different) <br />
<br />
'''''[[#top | Top]]'''''<br />
== Create PAC file ==<br />
Create the following file and save as '''test.pac''' to root folder '''L:\www''' <br />
{| cellpadding="4" cellspacing="1" style="background:#000000;"<br />
|- style="background:#e8e8e8;"<br />
!test.pac File<br />
|- style="background:#f5f5f5;"<br />
|<br />
<pre style="border:none"><br />
function FindProxyForURL(url, host)<br />
{<br />
if (shExpMatch(url,"http://center.uniformserver.com/*")) return "PROXY 127.0.0.1";<br />
return "";<br />
} <br />
</pre><br />
|}<br />
<br />
'''''[[#top | Top]]'''''<br />
=== Install PAC file ===<br />
# Run Firefox by double clicking on file '''FirefoxPortable.exe''' located L:\fx3\FirefoxPortable\FirefoxPortable.exe<br />
# Select Tools > '''Options'''<br />
# Select '''Advanced''' Icon<br />
# Select '''Network''' Tab<br />
# Click '''Settings button'''<br />
# Check '''Automatic proxy configuration URL''' radio button<br />
# Type-in '''<nowiki>http://localhost/test.pac</nowiki>'''<br />
# Click '''OK twice''' to close both dialogs.<br />
# Close Firefox.<br />
<br />
'''''[[#top | Top]]'''''<br />
<br />
== Test ==<br />
# Start Uniform Server (Double click on unicontroller.exe) and start servers.<br />
# Run Firefox by double clicking on file '''FirefoxPortable.exe''' located L:\fx3\FirefoxPortable\FirefoxPortable.exe<br />
# Type the following into browser address bar: '''<nowiki>http://localhost/test.pac</nowiki>'''<br />
# Contents of folder '''www/center''' displayed.<br />
<br />
=== Automate ===<br />
When the USB stick is plugged in we need to start Firefox and UniController.<br />
<br />
It is possible that a version of Firefox is already running, this will prevent our portable version running hence first kill any running Firefox. Then start UniController, since there are several commands these are placed in a batch file which is run by autorun.<br />
<br />
=== New batch files ===<br />
Create a new batch file ff_pac.bat and save to USB root<br />
<br />
{| cellpadding="2" cellspacing="1" style="background:#000000;"<br />
|- style="background:#e8e8e8;"<br />
!ff_pac.bat<br />
|- style="background:#f5f5f5;"<br />
|<br />
<pre style="border:none;padding:2px"><br />
TITLE UNIFORM SERVER - PAC<br />
COLOR B0<br />
mode con:cols=60 lines=20<br />
@echo off<br />
cls<br />
rem ###################################################<br />
rem # Name: ff_pac.bat<br />
rem # Location: root of USB stic<br />
rem # Edited Last By: MPG (ric)<br />
rem # V 1.0 7-2-2009<br />
rem ##################################################<br />
echo.<br />
<br />
rem working directory current folder <br />
pushd %~dp0<br />
<br />
rem ### kill running FF<br />
home\admin\program\pskill.exe firefox.exe c<br />
home\admin\program\pskill.exe FirefoxPortable.exe c<br />
<br />
rem ### start USB Firefox<br />
start fx3\FirefoxPortable\FirefoxPortable.exe<br />
<br />
rem ### Before starting UniController wait for FF to start <br />
rem ### Safety loop counter cnt give up after 60 seconds<br />
echo Starting FF ...............<br />
<br />
echo.<br />
set /a cnt=0<br />
:next1<br />
set /a cnt+=1<br />
if "%cnt%"=="60" goto :TIMEDOUT<br />
home\admin\program\unidelay.exe<br />
home\admin\program\pskill.exe FirefoxPortable.exe > nul<br />
IF ERRORLEVEL 1 goto :next1<br />
<br />
rem ### start UniController<br />
home\admin\program\unidelay.exe 4<br />
start unicontroller.exe<br />
goto :END<br />
<br />
:TIMEDOUT<br />
echo Unable to start FF<br />
pause<br />
<br />
:END<br />
rem restore original working directory<br />
popd<br />
</pre><br />
|}<br />
<br />
=== Auto Run ===<br />
First check you can start Firefox and UniController using the batch file.<br />
<br />
Now create a file named '''autorun.inf''' and save to USB root. The one I used for testing is shown below:<br />
<br />
{| cellpadding="2" cellspacing="1" style="background:#000000;"<br />
|- style="background:#e8e8e8;"<br />
!autorun.inf<br />
|- style="background:#f5f5f5;"<br />
|<br />
<pre style="border:none;padding:2px"><br />
[autorun]<br />
open=ff_pac.bat<br />
action=Run FF UniController<br />
icon=docs\SRC\uslogo.ico<br />
</pre> <br />
|}<br />
<br />
When your memory stick is plugged in you will receive the following message just click OK:<br />
<br />
''Launch '''FF UniformServer''' using the program provided on the device''<br />
<br />
'''''[[#top | Top]]'''''<br />
<br />
== Summary ==<br />
The above was not intended to be a definitive guide it provides a working example that you can expand for your own applications.<br />
<br />
Instead of using UniController you can use batch files. This is covered on the following pages [[Virtual Hosting: Home | Virtual Hosting]], although written for 3.5 the material is transferable to 4.0-Mona.<br />
<br />
'''''[[#top | Top]]'''''<br />
<br />
----<br />
<br />
[[Category: Uniform Server 4.0-Mona]]<br />
[[Category: Installation]]</div>Ric