<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.appstudio.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=James</id>
	<title>NSB App Studio - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.appstudio.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=James"/>
	<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/Special:Contributions/James"/>
	<updated>2026-11-29T04:02:03Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.46.3</generator>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=JDBC_Plugin&amp;diff=8478</id>
		<title>JDBC Plugin</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=JDBC_Plugin&amp;diff=8478"/>
		<updated>2016-06-09T15:16:25Z</updated>

		<summary type="html">&lt;p&gt;James: ODBC != JDBC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This plugin allows you to execute simple queries against any database with a JDBC driver using Android. Due to the requirement of adding a driver JAR, it&#039;s not compatible with automated build services (like PhoneGap Build). You&#039;ll need to use [[PhoneGap CLI|PhoneGap CLI]] &lt;br /&gt;
&lt;br /&gt;
The plugin provides a generic interface for using JDBC libraries with a PhoneGap plugin. The interface has a hook to a Java driver which does the actual work. [https://en.wikipedia.org/wiki/JDBC_driver JDBC drivers] are available for many databases.&lt;br /&gt;
&lt;br /&gt;
The main documentation and files for the plugin are here: https://github.com/arsmentis/cordova-plugin-jdbc. In this document, we will discuss how to use the plugin from AppStudio.&lt;br /&gt;
&lt;br /&gt;
Begin by making sure the PhoneGap CLI toolchain is installed properly. Documentation for installing it is in the Install Tools section of this page: [[PhoneGap CLI|here]]. &lt;br /&gt;
&lt;br /&gt;
Next, create a new project in AppStudio. You&#039;ll need to do a couple of extra steps:&lt;br /&gt;
&lt;br /&gt;
# Add the hook to configxml: Open configxml in Project Properties. Add the hook declaration just after &amp;amp;lt;platform name=&amp;quot;android&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;platform name=&amp;quot;android&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;amp;lt;hook type=&amp;quot;after_prepare&amp;quot; src=&amp;quot;scripts/copyDriver.js&amp;quot; /&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:WebSocketsEchoServer.VBExpress2012.zip&amp;diff=6913</id>
		<title>File:WebSocketsEchoServer.VBExpress2012.zip</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:WebSocketsEchoServer.VBExpress2012.zip&amp;diff=6913"/>
		<updated>2015-02-16T20:27:26Z</updated>

		<summary type="html">&lt;p&gt;James: James uploaded a new version of File:WebSocketsEchoServer.VBExpress2012.zip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Using_PhoneGap_to_create_an_Android_APK&amp;diff=6182</id>
		<title>Using PhoneGap to create an Android APK</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Using_PhoneGap_to_create_an_Android_APK&amp;diff=6182"/>
		<updated>2014-08-12T04:23:57Z</updated>

		<summary type="html">&lt;p&gt;James: Removed iOS specific info and updated build docs link.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this tutorial is to show how to use PhoneGap to turn an App Studio project into a native Android app (.apk).&lt;br /&gt;
&lt;br /&gt;
Normally, App Studio produces webapps, which are installed through the browser and can be saved to the Home screen. If you want to create an app which is distributed as an Android APK file, you need to compile it using the Android SDK. PhoneGap lets you do this with no change to your code.&lt;br /&gt;
&lt;br /&gt;
PhoneGap also gives you access to [http://www.phonegap.com/about/feature features] that are not available to App Studio. These include the compass, contacts and notifications. In addition, you can develop your own native code extensions. Here&#039;s a good introduction to [http://hiediutley.com/2011/03/28/phonegap-tutorial-series-3-extending-the-phonegap-api/ creating PhoneGap plugins].&lt;br /&gt;
&lt;br /&gt;
PhoneGap has two methods of doing this. The easier one is [http://build.phonegap.com/apps PhoneGap Build]. Use &amp;quot;Build Native App with PhoneGap&amp;quot; on the Run menu to upload your project to their site. In a few minutes, you can download app-store ready apps for Apple iOS, Google Android, Palm, Symbian, BlackBerry and more.&lt;br /&gt;
&lt;br /&gt;
The more complex method is the PhoneGap CLI. You will need to download the full development SDK, install and configure, then compile on your own machine. This method is free, but can be time consuming and tricky to set up.&lt;br /&gt;
&lt;br /&gt;
Here is a full comparison of [[Web_Apps_Compared_to_PhoneGap_Apps|Web Apps vs. PhoneGap apps]].&lt;br /&gt;
&lt;br /&gt;
== PhoneGap Build ==&lt;br /&gt;
&lt;br /&gt;
To use PhoneGap Build, choose &amp;quot;Build Native App with PhoneGap&amp;quot; under the Run menu. Your app will be uploaded to PhoneGap&#039;s compilation service. You can check on the status of the builds using &amp;quot;Get Native Build Status&amp;quot;. Files are usually ready to download in a minute or so.&lt;br /&gt;
&lt;br /&gt;
App Studio installs with a demo PhoneGap Build account. You&#039;ll want to set up your own account to use. It&#039;s quick and easy to do.&lt;br /&gt;
&lt;br /&gt;
PhoneGap has a [[Phonegap_debugger|handy debugger]] - it&#039;s essential when things go wrong.&lt;br /&gt;
&lt;br /&gt;
[[File:PhonegapStatus.png]]&lt;br /&gt;
&lt;br /&gt;
== PhoneGap CLI ==&lt;br /&gt;
&lt;br /&gt;
The best instructions for using the PhoneGap CLI are on [http://docs.phonegap.com/en/3.5.0/guide_overview_index.md.html#Overview PhoneGap&#039;s website].&lt;br /&gt;
&lt;br /&gt;
In your PhoneGap project&#039;s folder, you will have a www folder. On the Deploy Options screen, use the &#039;Deploy to local or DropBox public folder&#039; option. Put path of the www folder in &#039;Local Path&#039;. Deploy will then copy the proper files into the www folder.&lt;br /&gt;
&lt;br /&gt;
== PhoneGap Debugger ==&lt;br /&gt;
You can debug a PhoneGap app (created from NSB AppStudio) on the Android Emulator. Here&#039;s how:&lt;br /&gt;
&lt;br /&gt;
1. open a DOS console&lt;br /&gt;
&lt;br /&gt;
2. launch emulator on my &amp;quot;nsb&amp;quot; image (created with [AndroidSDK_PATH]\AVD Manager.exe) &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[AndroidSDK_PATH]\tools\emulator.exe -avd nsb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. install pkg on the only launched emulator&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[AndroidSDK_PATH]\platform-tools\tools\adb.exe -e install e:\MyApp-debug.apk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or reinstall:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[AndroidSDK_PATH]\platform-tools\tools\adb.exe -e install -r e:\MyApp_Test-debug.apk)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. show Android emulator logs in the DOS console&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[AndroidSDK_PATH]\platform-tools\tools\adb.exe logcat&lt;br /&gt;
&lt;br /&gt;
or show only PhoneGap logs in the DOS Console&lt;br /&gt;
&lt;br /&gt;
[AndroidSDK_PATH]\platform-tools\tools\adb.exe logcat CordovaLog:D *:S&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
see: http://wildermuth.com/2013/4/30/Debugging_PhoneGap_with_the_Android_Console&lt;br /&gt;
&lt;br /&gt;
== Google Play Store ==&lt;br /&gt;
&lt;br /&gt;
To list your app in the Google Play Store (or build a non-debug .apk), you will need to sign it. Here&#039;s a video showing how:&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=26pWIWj9QRk&lt;br /&gt;
&lt;br /&gt;
PhoneGap&#039;s documentation is here:&lt;br /&gt;
&lt;br /&gt;
http://docs.build.phonegap.com/en_US/signing_signing-android.md.html&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Solutions_to_Common_Problems&amp;diff=6176</id>
		<title>Solutions to Common Problems</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Solutions_to_Common_Problems&amp;diff=6176"/>
		<updated>2014-07-31T00:45:00Z</updated>

		<summary type="html">&lt;p&gt;James: Added more detail for iOS cache problems.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== My app gets an error box when run on a device, or it does not run in Airplane mode.  ===&lt;br /&gt;
[[File:TN01.01.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means it is trying to use a file that has not been cached on the device. In Project Properties, check that all the images and files are listed in the manifest.  In certain cases it could mean the application cache on your device is corrupt.&lt;br /&gt;
&lt;br /&gt;
# Open a new Chrome window on the desktop.&lt;br /&gt;
# Open the [[Using_the_Chrome_Debugger|Chrome Debugger]] by clicking ctrl shift J on the keyboard. (option command J on Mac OS)&lt;br /&gt;
# Enter the URL of your program on your deploy site and hit enter.&lt;br /&gt;
# In the message panel at the bottom of the screen, you will see the files it caches.&lt;br /&gt;
# Make sure all the files your app uses appear without errors.&lt;br /&gt;
# Use Check Deployment on the Run menu to check your server. If it is incorrect, see [[Distributing_your_App#Setting_up_your_server_for_manifest_files_.28Apache.29|Setting up your server for manifest files]].&lt;br /&gt;
# Check to make sure that Private Browsing is not turned on.&lt;br /&gt;
# Make sure Cookies are not turned off in your browser.&lt;br /&gt;
# If possible, use the Chrome browser on Android devices (not the older Android browser).&lt;br /&gt;
# If all else fails, try clearing the cache of your browser. On iOS 7, do this by closing all tabs in Safari, then opening Settings...Safari. First clear history and your cache. Then go to Advanced...Website Data...Edit...wipe out nsbapp.com (or the name of your server). Finally restart your device.&lt;br /&gt;
&lt;br /&gt;
=== When I run my app on the desktop, I just get a blank screen. ===&lt;br /&gt;
&lt;br /&gt;
Your program is probably getting an error. Hit Ctrl-shift-J (option-shift-j on Mac) to open the [[Using_the_Chrome_Debugger|Chrome Debugger]] (assuming you are using Windows Chrome). You&#039;ll see the error.&lt;br /&gt;
&lt;br /&gt;
=== My app runs OK on the desktop, but nothing appears on the device. ===&lt;br /&gt;
&lt;br /&gt;
Check if JavaScript is turned off on the device.&lt;br /&gt;
&lt;br /&gt;
=== Parts of the IDE are distorted or do not pop up properly in Windows. ===&lt;br /&gt;
&lt;br /&gt;
Check if you are using an Aero theme on your desktop. Try switching to a non Aero theme.&lt;br /&gt;
&lt;br /&gt;
=== The background on the Design Screen is blank. ===&lt;br /&gt;
&lt;br /&gt;
* If you are running on a Mac using Parallels, make sure that &#039;My Documents&#039; in Windows is not mapped to its Mac equivalent.&lt;br /&gt;
* If you installed to a server, move \Documents\NS Basic Samples\ to your local system. Write access is required to that directory.&lt;br /&gt;
&lt;br /&gt;
=== In the Code Window, I cannot enter &#039;, &amp;quot; or extended characters ===&lt;br /&gt;
&lt;br /&gt;
If you are running on Mac OS, do not use &amp;quot;USA International PC&amp;quot; as your keyboard layout. It uses the single quote character (&#039;) to start entering some extended characters. The single quote is important in the code window to quote strings and start comments.&lt;br /&gt;
&lt;br /&gt;
=== I&#039;m running Anti Virus software. What could go wrong? ===&lt;br /&gt;
&lt;br /&gt;
Norton: Blocks installation with a WS.Reputation.1 message. If an executable is unknown to Norton (perhaps it is new), it automatically quarantines it. Since we update AppStudio frequently, this happens occasionally. Just take it out of the quarantine and it will work. We have contacted Norton about this - they say they have removed the block.&lt;br /&gt;
&lt;br /&gt;
McAfee: AppStudio runs slowly. McAfee has a Real Time Scanning option that intercepts every system call that the apps on your system make. On slower computers, this feature can bring the system to a crawl. Disable this feature to solve the problem.&lt;br /&gt;
&lt;br /&gt;
Kaspersky: AppStudio does not run. We&#039;re not sure if this Kaspersky related, or a corrupted system which caused this one. The solution was to &lt;br /&gt;
&amp;lt;OL&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;sfc /scannow, which resulted in the message that there were files to be repaired. &lt;br /&gt;
&amp;lt;li&amp;gt;update NVIDIA display driver of Jan 2013. &lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== In the Design Screen, some of my controls do not appear ===&lt;br /&gt;
&lt;br /&gt;
Are you using an HTMLview control anywhere in your project? If so, check that the innerHTML value is valid and complete HTML. For example, forgetting to match a &amp;amp;lt;div&amp;gt; or &amp;amp;lt;font&amp;gt; tag with a matching &amp;amp;lt;/div&amp;gt; or &amp;amp;lt;/font&amp;gt; tag will cause other problems in your project.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Testing_and_Deploying&amp;diff=6171</id>
		<title>Testing and Deploying</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Testing_and_Deploying&amp;diff=6171"/>
		<updated>2014-07-26T18:04:29Z</updated>

		<summary type="html">&lt;p&gt;James: More formatting.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The easiest way to test your app is in your desktop browser. Use “Start in Desktop Browser” under the Run menu. It will run in your default browser, which should support WebKit. At this time, Chrome and Safari support WebKit. &lt;br /&gt;
&lt;br /&gt;
You can debug your program using the desktop browser. For more information, see [[Using the Chrome Debugger]]. &lt;br /&gt;
&lt;br /&gt;
Once your program runs well in the desktop browser, you can deploy it to a server. Devices can then load your program from that server. &lt;br /&gt;
&lt;br /&gt;
== Start Up Time ==&lt;br /&gt;
&lt;br /&gt;
There are two parts to the startup: the Translation (which happens on the desktop) and the actual startup on the device.&lt;br /&gt;
&lt;br /&gt;
The Translation time will increase as the size of the app increases. Each time you run, any modules which have changed need to be retranslated. If you run twice in a row without changing your app, no translation needs to be done.&lt;br /&gt;
&lt;br /&gt;
You can make Translation faster by splitting your project into more modules. That way, not as much needs to be translated each time. It&#039;s also a good way to organize your code to make it more maintainable.&lt;br /&gt;
&lt;br /&gt;
== Deploying ==&lt;br /&gt;
&lt;br /&gt;
App Studio provides a server for testing apps, called the nsbapp.com. When you choose Deploy from the menu, your program and any files listed on the manifest are copied to the server. When the upload is complete, the IDE will give you the URL to open the app from. &lt;br /&gt;
&lt;br /&gt;
The first time the app is run on the device, the files on the manifest are copied to the device. Your app can then be run locally, without an internet connection. &lt;br /&gt;
&lt;br /&gt;
If you change your program and upload it again, there is a pause while the files are moved into place on nsbapp.com. &lt;br /&gt;
&lt;br /&gt;
The next time you run the program (or refresh), the device runs its current version from memory while it gets the latest manifest from the server. It compares them: if the manifest has changed, it then downloads the whole application again and saves it to the device. Once this is complete, the new version of the app will run next time you do a refresh.&lt;br /&gt;
&lt;br /&gt;
Use nsbapp.com for testing, not as a permanent home for your app. Old projects are automatically removed after a while, so they may become unavailable.&lt;br /&gt;
&lt;br /&gt;
For more information, see [[Distributing your App]].&lt;br /&gt;
&lt;br /&gt;
Next: [[About Screen]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Testing_and_Deploying&amp;diff=6170</id>
		<title>Testing and Deploying</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Testing_and_Deploying&amp;diff=6170"/>
		<updated>2014-07-26T18:03:59Z</updated>

		<summary type="html">&lt;p&gt;James: Formatting.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The easiest way to test your app is in your desktop browser. Use “Start in Desktop Browser” under the Run menu. It will run in your default browser, which should support WebKit. At this time, Chrome and Safari support WebKit. &lt;br /&gt;
&lt;br /&gt;
You can debug your program using the desktop browser. For more information, see [[Using the Chrome Debugger]]. &lt;br /&gt;
&lt;br /&gt;
Once your program runs well in the desktop browser, you can deploy it to a server. Devices can then load your program from that server. &lt;br /&gt;
&lt;br /&gt;
== Start Up Time ==&lt;br /&gt;
&lt;br /&gt;
There are two parts to the startup: the Translation (which happens on the desktop) and the actual startup on the device.&lt;br /&gt;
&lt;br /&gt;
The Translation time will increase as the size of the app increases. Each time you run, any modules which have changed need to be retranslated. If you run twice in a row without changing your app, no translation needs to be done.&lt;br /&gt;
&lt;br /&gt;
You can make Translation faster by splitting your project into more modules. That way, not as much needs to be translated each time. It&#039;s also a good way to organize your code to make it more maintainable.&lt;br /&gt;
&lt;br /&gt;
== Deploying ==&lt;br /&gt;
&lt;br /&gt;
App Studio provides a server for testing apps, called the nsbapp.com. When you choose Deploy from the menu, your program and any files listed on the manifest are copied to the server. When the upload is complete, the IDE will give you the URL to open the app from. &lt;br /&gt;
&lt;br /&gt;
The first time the app is run on the device, the files on the manifest are copied to the device. Your app can then be run locally, without an internet connection. &lt;br /&gt;
&lt;br /&gt;
If you change your program and upload it again, there is a pause while the files are moved into place on nsbapp.com. &lt;br /&gt;
&lt;br /&gt;
The next time you run the program (or refresh), the device runs its current version from memory while it gets the latest manifest from the server. It compares them: if the manifest has changed, it then downloads the whole application again and saves it to the device. Once this is complete, the new version of the app will run next time you do a refresh.&lt;br /&gt;
&lt;br /&gt;
Use nsbapp.com for testing, not as a permanent home for your app. Old projects are automatically removed after a while, so they may become unavailable.&lt;br /&gt;
&lt;br /&gt;
For more information, see [[Distributing_your_App]].&lt;br /&gt;
&lt;br /&gt;
Next: [[About Screen]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Ajax&amp;diff=6166</id>
		<title>Ajax</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Ajax&amp;diff=6166"/>
		<updated>2014-07-14T21:28:49Z</updated>

		<summary type="html">&lt;p&gt;James: Updating links.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ajax(&#039;&#039;URL&#039;&#039;[, &#039;&#039;method&#039;&#039;[, &#039;&#039;data&#039;&#039;[, &#039;&#039;returnFunction&#039;&#039;]]])&amp;lt;br&amp;gt;&lt;br /&gt;
Ajax(&#039;&#039;URL&#039;&#039;, &#039;&#039;settingsObject&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The Ajax function is used to get or receive data from a server. It is based on [[:wikipedia:XMLHttpRequest|XMLHttpRequest]]. This function will only work when running from a server (including the built in AppStudio local server) and is subject to the [[wikipedia:Same-origin_policy|same-origin policy]] in some cases. It is a wrapper for [https://api.jquery.com/jQuery.ajax/ jQuery&#039;s $.ajax() function].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;URL&#039;&#039; is the address on the server. It can be the name of a file to be downloaded from the server or a script to be run on the server. Optional information can be passed to the server at the end of the URL: for example &lt;br /&gt;
  http://www.nsbasic.com/getCustomerInfo.php?customer=Knuth &lt;br /&gt;
will call the PHP script named getCustomerInfo.php, passing the parameter customer=Knuth. Data passed in URLs must be encoded properly. This is done with [[EncodeURIComponent/decodeURIComponent|encodeURIComponent]].&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;method&#039;&#039; to define the access method. If this parameter is omitted, GET is used. The most common value for this is POST. POST responses are never cached, whereas GET responses can be. POST also allows larger data transfers. If you are using POST, put the information you want to send in data. The normal size limit for data is 8 megabytes: it is a server setting which can be increased. This is an easy and efficient way to send data to a server. Other useful methods are DELETE and PUT. For more information on these options, see [[:wikipedia:XMLHttpRequest#The_open_method|XMLHttpRequest&#039;s open method]].  For more information on other methods see [[:wikipedia:Hypertext_Transfer_Protocol#Request_methods|HTTP request methods]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;returnFunction&#039;&#039;, if supplied, is a function to be called when the results return, allowing asynchronous execution. If this parameter is not supplied, execution will continue at the next statement after the results return. Do not put MsgBox statements inside your Ajax code: they mess up the event sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;settingsObject&#039;&#039; is an object containing all the settings, in the form {data: &amp;quot;some data&amp;quot;, type: &amp;quot;GET&amp;quot;, success: AjaxWorked}. For a complete list of possible settings, see the [https://api.jquery.com/jQuery.ajax/ $.ajax docs].&lt;br /&gt;
&lt;br /&gt;
It returns the following values:&lt;br /&gt;
&lt;br /&gt;
.status:  The status of the response to the request. This is the [http://en.wikipedia.org/wiki/List_of_HTTP_status_codes HTTP result code] (for example, status is 200 for a successful request). 404 means page not found.&lt;br /&gt;
&lt;br /&gt;
.statusText: The response string returned by the HTTP server. Unlike status, this includes the entire text of the response message (&amp;quot;200 OK&amp;quot;, for example).&lt;br /&gt;
&lt;br /&gt;
.responseText: The response to the request as text, or null if the request was unsuccessful or has not yet been sent.&lt;br /&gt;
&lt;br /&gt;
.readyState: The state of the request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
State  Description&lt;br /&gt;
0      UNSENT:The request is not initialized&lt;br /&gt;
1      OPENED: The request has been set up&lt;br /&gt;
2      HEADERS_RECEIVED send() has been called, and headers and status are available.&lt;br /&gt;
3      LOADING: Downloading; responseText holds partial data.&lt;br /&gt;
4      DONE: The request is complete&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also samples Ajax and AjaxPost for more information.&lt;br /&gt;
&lt;br /&gt;
== Example (BASIC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&#039;Ajax example&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajax.php?myText=&amp;quot; &amp;amp; encodeURIComponent(txtSend.value))&lt;br /&gt;
If req.status = 200 Then &#039;success&lt;br /&gt;
    txtResponse.value = req.responseText&lt;br /&gt;
Else &#039;failure&lt;br /&gt;
    txtResponse.value = &amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
&#039;Sample POST call&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajaxPost.php&amp;quot;, &amp;quot;POST&amp;quot;, &amp;quot;myText=&amp;quot; &amp;amp; encodeURIComponent(txtSend.value))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example (JavaScript) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
//Ajax example&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajax.php?myText=&amp;quot; + encodeURIComponent(txtSend.value));&lt;br /&gt;
if(req.status == 200) { //success&lt;br /&gt;
    txtResponse.value = req.responseText;&lt;br /&gt;
  } else { //failure&lt;br /&gt;
    txtResponse.value = &amp;quot;Error: &amp;quot;  +  req.err.message;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 //Sample POST call&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajaxPost.php&amp;quot; , &amp;quot;POST&amp;quot; , &amp;quot;myText=&amp;quot;  +  encodeURIComponent(txtSend.value));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Items ==&lt;br /&gt;
&lt;br /&gt;
* [[ReadFile]]&lt;br /&gt;
&lt;br /&gt;
* [[Ajax made Simple]]&lt;br /&gt;
&lt;br /&gt;
* [[EncodeURIComponent/decodeURIComponent]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language Reference]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=GetJSON&amp;diff=6165</id>
		<title>GetJSON</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=GetJSON&amp;diff=6165"/>
		<updated>2014-07-14T21:27:15Z</updated>

		<summary type="html">&lt;p&gt;James: Updated link.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GetJSON(&#039;&#039;url&#039;&#039;,&#039;&#039;data&#039;&#039;,&#039;&#039;callback&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
GetJSON loads JSON-encoded data from the server using a GET HTTP request. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;url&#039;&#039; is the location that data is being requested from.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;data&#039;&#039; is the information about the request. If multiple fields are being passed, include them in a single string, separated by ampersand (&amp;amp;) characters. It&#039;s best to do an [[EncodeURIComponent/decodeURIComponent|encodeURIComponent]]() to the data to make sure that spaces and other special characters are properly formatted.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;callback&#039;&#039; is the name of the function in your program to be called when the request is complete. Since the request may take a little while to complete, your app will continue execution immediately after the GetJSON() function is called. The results will not be available until the &#039;&#039;callback&#039;&#039; function is called. The returned data is passed to the &#039;&#039;callback&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
If you are using this with PhoneGap, remember to [http://docs.phonegap.com/en/3.4.0/guide_appdev_whitelist_index.md.html#Whitelist%20Guide add the remote site to your whitelist]. Do this by adding lines to your PhoneGap configxml project property.&lt;br /&gt;
&lt;br /&gt;
For uploading data, GetJSON has a limit imposed by a server setting: it is usually 8192 bytes. There is no response size limit. If you need to send more information, use the [[Ajax]]() function.&lt;br /&gt;
&lt;br /&gt;
This function is a wrapper for the jQuery [http://api.jquery.com/jQuery.getJSON/ $.getJSON()] function. It works identically.&lt;br /&gt;
&lt;br /&gt;
=== Server side ===&lt;br /&gt;
&lt;br /&gt;
GetJSON a much easier and more compatible way of calling a cross domain web server.  GetJSON supports this out of the&lt;br /&gt;
box.  You will have to:&lt;br /&gt;
&lt;br /&gt;
# Append ?callback=? to your URL.&lt;br /&gt;
# Change your MIME type to application/javascript&lt;br /&gt;
# Read in the callback parameter server side and respond with the JSON wrapped in the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cbvalue(json);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cbvalue is the value of callback, json is your JSON data.&lt;br /&gt;
&lt;br /&gt;
This will allow you to make cross domain requests without messing with headers or browser settings.&lt;br /&gt;
&lt;br /&gt;
=== Testing an API Function ===&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a trick you can use to test many of these API calls. Combine the URL and the parameters into a single string separated by a question mark (&amp;quot;?&amp;quot;):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://api.openweathermap.org/data/2.5/weather?q=Toronto&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Paste this into a browser and you will get:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&amp;quot;coord&amp;quot;:{&amp;quot;lon&amp;quot;:-79.39,&amp;quot;lat&amp;quot;:43.65},&amp;quot;sys&amp;quot;:&lt;br /&gt;
{&amp;quot;message&amp;quot;:0.0454,&amp;quot;country&amp;quot;:&amp;quot;Canada&amp;quot;,&amp;quot;sunrise&amp;quot;:1396263570,&lt;br /&gt;
&amp;quot;sunset&amp;quot;:1396309411},&amp;quot;weather&amp;quot;:[{&amp;quot;id&amp;quot;:801,&amp;quot;main&amp;quot;:&amp;quot;Clouds&amp;quot;,&lt;br /&gt;
&amp;quot;description&amp;quot;:&amp;quot;few clouds&amp;quot;,&amp;quot;icon&amp;quot;:&amp;quot;02n&amp;quot;}],&amp;quot;base&amp;quot;:&amp;quot;cmc stations&amp;quot;,&lt;br /&gt;
&amp;quot;main&amp;quot;:&amp;quot;temp&amp;quot;:273.2,&amp;quot;humidity&amp;quot;:54,&amp;quot;pressure&amp;quot;:1019,&lt;br /&gt;
&amp;quot;temp_min&amp;quot;:271.48,&amp;quot;temp_max&amp;quot;:275.15},&amp;quot;wind&amp;quot;:{&amp;quot;speed&amp;quot;:2.3,&lt;br /&gt;
&amp;quot;deg&amp;quot;:320.501},&amp;quot;rain&amp;quot;:{&amp;quot;3h&amp;quot;:0},&amp;quot;snow&amp;quot;:{&amp;quot;3h&amp;quot;:0},&amp;quot;clouds&amp;quot;:{&amp;quot;all&amp;quot;:12},&lt;br /&gt;
&amp;quot;dt&amp;quot;:1396259691,&amp;quot;id&amp;quot;:6167865,&amp;quot;name&amp;quot;:&amp;quot;Toronto&amp;quot;,&amp;quot;cod&amp;quot;:200}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Encoding the Parameters ===&lt;br /&gt;
&lt;br /&gt;
Certain characters, such as the space key, are not allowed in URL strings. The above example would fail on the city &amp;quot;New York&amp;quot; if it was not encoded. The [[EncodeURIComponent/decodeURIComponent|encodeURIComponent]]() function converts your parameters into a string which will work perfectly as a URL.&lt;br /&gt;
&lt;br /&gt;
== Example (BASIC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function btnLoad_onclick()&lt;br /&gt;
  Dim city = &amp;quot;q=&amp;quot; &amp;amp; encodeURIComponent(txtCity.value)&lt;br /&gt;
  Dim URL = &amp;quot;http://api.openweathermap.org/data/2.5/weather&amp;quot;&lt;br /&gt;
  GetJSON(URL, city, weatherData)&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Sub weatherData(data)&lt;br /&gt;
  MsgBox &amp;quot;Temperature is &amp;quot; &amp;amp; data.main.temp - 273.15&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example (JavaScript) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function btnLoad_onclick() {&lt;br /&gt;
  var city = &amp;quot;q=&amp;quot; + encodeURIComponent(txtCity.value);&lt;br /&gt;
  var URL = &amp;quot;http://api.openweathermap.org/data/2.5/weather&amp;quot;;&lt;br /&gt;
  GetJSON(URL, city, weatherData);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function weatherData(data) {&lt;br /&gt;
  alert(&amp;quot;Temperature is &amp;quot; + data.main.temp - 273.15);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Items ==&lt;br /&gt;
&lt;br /&gt;
* [[Ajax]]&lt;br /&gt;
* [[EncodeURIComponent/decodeURIComponent]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language Reference]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Ajax_made_Simple&amp;diff=6164</id>
		<title>Ajax made Simple</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Ajax_made_Simple&amp;diff=6164"/>
		<updated>2014-07-14T21:26:30Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most developers have heard of Ajax by now. Unless you&#039;ve worked with it, you probably think it&#039;s another complicated form of alphabet soup. It actually turns out to be quite easy to use from AppStudio.&lt;br /&gt;
&lt;br /&gt;
First, let&#039;s explain what it is (and isn&#039;t). It stands for [http://en.wikipedia.org/wiki/Ajax_(programming) Asynchronous JavaScript And XML]. The good news is that there&#039;s no need to be asynchronous or to use XML - and that AppStudio takes care of the JavaScript.&lt;br /&gt;
&lt;br /&gt;
[[Ajax]] makes it easy to exchange data with your server. Think of it as a function you can call that is running on another system. You can pass it parameters and it can return values. Since it&#039;s running on your server, it can do things that you cannot do on your device. It can access files and databases on the server, or get data from other web sites without worrying about [http://en.wikipedia.org/wiki/Same_origin_policy Same Origin Policies].&lt;br /&gt;
&lt;br /&gt;
You will need to use a server with PHP enabled to run these samples. The nsbapp.com site does not have PHP enabled.&lt;br /&gt;
&lt;br /&gt;
=== A Simple Exchange of Data with the server ===&lt;br /&gt;
&lt;br /&gt;
Let&#039;s look at some code. We will have our AppStudio app send the server a string, which the server will return reversed. Here is what the app looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:Ajax1.jpg]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The only code in this app is the &amp;quot;Reverse&amp;quot; button. The [[Ajax]] function sends the contents of the top textarea to a PHP script that is running on the server. If it returns successfully, we display what came back. Otherwise, we show the error:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dim req&lt;br /&gt;
Function btnAjax_onclick()&lt;br /&gt;
  req=Ajax(&amp;quot;ajax.php/?myText=&amp;quot; &amp;amp; encodeURIComponent(txtSend.value))&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    txtResponse.value=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    txtResponse.value=&amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The PHP script is even easier. It gets the input that is named myText, reverses it, and uses the echo statement to send it back.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
 // Get the data from the client. &lt;br /&gt;
 $myText = $_GET[&#039;myText&#039;];&lt;br /&gt;
 // Send back the text, reversed&lt;br /&gt;
 echo &amp;quot;Data received from Device (reversed): &amp;quot; . strrev($myText); &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is the result:&lt;br /&gt;
&lt;br /&gt;
[[File:Ajax2.jpg]]&lt;br /&gt;
&lt;br /&gt;
A few notes:&lt;br /&gt;
&lt;br /&gt;
* The php script needs to be on the same folder on the server as the AppStudio app.&lt;br /&gt;
* [[Ajax]] is based on XMLHttpPost.&lt;br /&gt;
* A handy way to return data from your PHP script is in [http://blog.nsbasic.com/?p=425 JSON] format. PHP even has a handy json_encode() function.&lt;br /&gt;
* PHP is not enabled on the nsbapp.com server.&lt;br /&gt;
&lt;br /&gt;
=== Using POST to Send more Data to the Server ===&lt;br /&gt;
&lt;br /&gt;
Let&#039;s extend what we are doing a bit and talk about using the POST method.&lt;br /&gt;
&lt;br /&gt;
We discussed the simplest [[Ajax]] call, which sends data to the server by adding it to the end of the URL, a method called, rather misleadingly, GET. But what if we want to send more data? GET has a limit, some say, of around 2000 characters. For more than that, we&#039;ll use the also badly named POST method. POST has an upload limit on most servers of 8 megabytes. If you need more, server settings can be adjusted.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s look at some code. You&#039;ll see it looks very much like our last post:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function btnAjax_onclick()&lt;br /&gt;
  req=Ajax(&amp;quot;ajaxPost.php&amp;quot;,&amp;quot;POST&amp;quot;,txtSend.value)&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    htmResponse.innerHTML=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    htmResponse.innerHTML=&amp;quot;Error: &amp;quot; &amp;amp; req.err&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The difference is a couple of extra parameters. We add &amp;quot;POST&amp;quot; and the data we want to send as a separate parameter. Before we talk about what is going to happen at the server end, let&#039;s see what the app looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:Ajaxpost.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OK, here is the PHP code on the server which we are calling:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
 // uncomment the next line to see runtime error messages from this script&lt;br /&gt;
 // ini_set(&#039;display_errors&#039;,&#039;1&#039;);&lt;br /&gt;
 &lt;br /&gt;
 // Get the data from the client.&lt;br /&gt;
 $myText = file_get_contents(&#039;php://input&#039;);&lt;br /&gt;
 // Send back the text, reversed&lt;br /&gt;
 echo &amp;quot;Data received from Device (reversed):&amp;lt;br&amp;gt;&amp;quot; . strrev($myText); &lt;br /&gt;
 &lt;br /&gt;
 //write the data out to a file on the server&lt;br /&gt;
 //make sure permissions are all OK!&lt;br /&gt;
 $myFile = &amp;quot;AjaxPost/ajaxPost.txt&amp;quot;;&lt;br /&gt;
 echo &amp;quot;&amp;lt;p&amp;gt;Writing data to &amp;quot; . getcwd() . $myFile;&lt;br /&gt;
 $f = fopen($myFile, &#039;w&#039;) or die(&amp;quot;can&#039;t open file&amp;quot;);&lt;br /&gt;
 fwrite($f, $myText);&lt;br /&gt;
 fclose($f);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The file_get_contents(&#039;php://input&#039;) call gets the data, exactly as it was sent. We&#039;ll do two things with it: echo it back reversed and we will write it to a file on the server. The first part is easy: anything in an echo statement is sent back to our app:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;Data received from Device (reversed):&amp;quot; . strrev($myText); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part involves a bit more PHP, but is straightforward. It writes the data was received to a file.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
$myFile = &amp;quot;AjaxPost/ajaxPost.txt&amp;quot;;&lt;br /&gt;
 echo &amp;quot;&amp;lt;p&amp;gt;Writing data to &amp;quot; . getcwd() . $myFile;&lt;br /&gt;
 $f = fopen($myFile, &#039;w&#039;) or die(&amp;quot;can&#039;t open file&amp;quot;);&lt;br /&gt;
 fwrite($f, $myText);&lt;br /&gt;
 fclose($f);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What would you use this feature for?&lt;br /&gt;
&lt;br /&gt;
* Upload a JSON copy of your database.&lt;br /&gt;
* Upload some pictures in Base64 format.&lt;br /&gt;
* Create a .htm file which can be accessed as a web page.&lt;br /&gt;
* Lots more ideas!&lt;br /&gt;
&lt;br /&gt;
A tip on debugging PHP scripts Since PHP scripts run on the server and not on your screen, you don&#039;t get to see the error messages. This can make debugging difficult. If you put this statement at the top of your PHP script, the error messages will be echoed to your app:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ini_set(&#039;display_errors&#039;,&#039;1&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The error messages come back as HTML formatted text. The best way to look at them is to assign them to the innerText property of an HTMLview control.&lt;br /&gt;
&lt;br /&gt;
=== Getting Data from Another Site ===&lt;br /&gt;
&lt;br /&gt;
One of the basic security features of the modern web is the [http://en.wikipedia.org/wiki/Same_origin_policy Same Origin Policy]. It states that a web app cannot pull up just any data from another site. This becomes a problem if you need data on someone else&#039;s site.&lt;br /&gt;
&lt;br /&gt;
Fortunately, they left an easy workaround. While a web app isn&#039;t allowed to access the files on another site, a PHP script is. We&#039;ll get our PHP script to do the dirty work for us and return the results to our app. The technique we will use is often called [http://en.wikipedia.org/wiki/Web_scraping scraping].&lt;br /&gt;
&lt;br /&gt;
Time to look at some code again. Here&#039;s the AppStudio part that calls the PHP script. It looks very much like the code in A Simple Exchange of Data with the server above. The main difference is that we&#039;re calling a different PHP script.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function btnGetFile_onclick()&lt;br /&gt;
  req=Ajax(&amp;quot;ajaxGetURL.php/?urlToGet=&amp;quot; &amp;amp; encodeURIComponent(txtURL.value))&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    htmResponse.innerHTML=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    htmResponse.innerHTML=req.err&lt;br /&gt;
  End If&lt;br /&gt;
  htmResponse.refresh()&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Before we talk about what is going to happen at the server end, let&#039;s see what the app looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:Ajaxgeturl.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And here is what the PHP script looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$ch = curl_init($_GET[&#039;urlToGet&#039;]);&lt;br /&gt;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);&lt;br /&gt;
$data = curl_exec($ch);&lt;br /&gt;
curl_close($ch);&lt;br /&gt;
echo $data&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let&#039;s take apart this one line:&lt;br /&gt;
&lt;br /&gt;
* $_GET(&#039;urlToGet&#039;) gets the parameter string that was attached to the URL in our AppStudio code.&lt;br /&gt;
* _file_get_contents get the contents of the file, in this case, the URL that was passed.&lt;br /&gt;
* echo sends the result back to our AppStudio program.&lt;br /&gt;
&lt;br /&gt;
Pretty simple, isn&#039;t it?&lt;br /&gt;
&lt;br /&gt;
(In this example, we&#039;re grabbing the robots.txt file from Microsoft&#039;s site, just to show we can get files from anywhere. Nearly all sites have a robots.txt file: it is used to guide search engines.)&lt;br /&gt;
&lt;br /&gt;
There is a simpler way to do this, but it can run into security problems.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo file_get_contents($_GET[&#039;urlToGet&#039;]); &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How fast is it? ===&lt;br /&gt;
&lt;br /&gt;
If your app is going to communicate with your server while it is running, you&#039;ve probably wondered how much your app will slow down when it has to wait for the server.&lt;br /&gt;
&lt;br /&gt;
In this blog post, we&#039;re going to make a program to test this. We&#039;ll construct a little program which sends data to the server as many times as it can. The server will record the information in a log file. Here is what our app will do:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Do Until SysInfo(10) &amp;gt; limit&lt;br /&gt;
    req=Ajax(&amp;quot;ajaxLog.php/?myText=&amp;quot; + encodeURIComponent(Now))&lt;br /&gt;
    counter=counter+1&lt;br /&gt;
  Loop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
SysInfo(10) is the current time in milliseconds. Limit is the time we want run to. You can run this test for up to about 5 seconds: after that, the system will think you are in a endless loop and shut you down.&lt;br /&gt;
&lt;br /&gt;
On the server side, we need a PHP script to get the messages and write them out to disk. Here&#039;s the code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  // read and append to file&lt;br /&gt;
  $myFile = &amp;quot;AjaxLog/log.txt&amp;quot;;&lt;br /&gt;
  $f = fopen($myFile, &#039;a&#039;) or die(&amp;quot;can&#039;t open file&amp;quot;);&lt;br /&gt;
  fwrite($f, $_GET[&#039;myText&#039;] . Chr(13) . Chr(10));&lt;br /&gt;
  fclose($f);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now, let&#039;s run it on a few different devices and see how many accesses we can do per second:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Desktop (Ethernet) || 2745.0&lt;br /&gt;
|-&lt;br /&gt;
| iPhone 4 (WiFi) || 10.5&lt;br /&gt;
|-&lt;br /&gt;
| iPhone (3G) || 2.5&lt;br /&gt;
|-&lt;br /&gt;
| Nexus S (WiFi) || 5.0&lt;br /&gt;
|-&lt;br /&gt;
| Kindle Fire (WiFi) || 9.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It&#039;s obvious that the speed that really depends on what kind of connection you have to the web. A hard wire to your router gets the best time. WiFi is much slower, and 3G is slower again. No real surprise here.&lt;br /&gt;
&lt;br /&gt;
The speeds shown here probably are not what you will see if you run the same test. There are a number of factors that will affect the speed:&lt;br /&gt;
&lt;br /&gt;
* Type of data connection&lt;br /&gt;
* Load on the network&lt;br /&gt;
* Number of hops the data has to make to get to the server&lt;br /&gt;
* Load on the server&lt;br /&gt;
&lt;br /&gt;
(You can try this sample yourself - it is called AjaxLog in the Samples folder.)&lt;br /&gt;
&lt;br /&gt;
=== Asynchronous Calls ===&lt;br /&gt;
&lt;br /&gt;
In our last Ajax discussion, we discovered that it could take half a second for an [[Ajax]] call to complete (actually, due to network latency, it could even be a lot more than that.) How do we do [[Ajax]] calls and not make our app look slow?&lt;br /&gt;
&lt;br /&gt;
Easy. We send the Ajax message off, then go do other stuff. When the response comes back, we respond to it. This is called Asynchronous operation.&lt;br /&gt;
&lt;br /&gt;
We do this by adding the name of the function to be called on completion as the 4th parameter of our [[Ajax]] call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
req=Ajax(&amp;quot;ajax.php/?myText=&amp;quot; + encodeURIComponent(txtSend.value), &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, done)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Our callback function is called &#039;done&#039;. After we execute the Ajax call, the program goes on to the next statement in the program immediately. It doesn&#039;t wait for any response. We can update the screen, or wait for the user to do something else. When the reply comes back, our &#039;done&#039; function will be called:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function done()&lt;br /&gt;
  If req.readyState&amp;lt;&amp;gt;4 Then Exit Function &#039;ignore progress reports&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    txtResponse.value=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    txtResponse.value=&amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;done&#039; will actually be called several times with progress reports on the call. We only care if it completes, so we wait for req.readyState to be 4. The rest of our function works just like when we were not asynchronous.&lt;br /&gt;
&lt;br /&gt;
One of the uses of this technique that we see every day is to return partial results on a search field (as in Google). Each time a character is entered, it is sent to the server for a list of possible matches. As the results come back, the window is updated. Entering characters in the field is unaffected by the server communications that are going on at the same time.&lt;br /&gt;
&lt;br /&gt;
Check out the AjaxAsync app in the Samples to see this in action.&lt;br /&gt;
&lt;br /&gt;
=== Caching ===&lt;br /&gt;
&lt;br /&gt;
Sometimes when you make the same request repeatedly, you&#039;ll get the same result, even through the data on the server has changed. The browser is &amp;quot;helping&amp;quot; you by delivering the same result from its cache instead of going out to the server again. To fix this, add a time stamp to the query string. This example puts the number of milliseconds into the string:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
req=Ajax(&amp;quot;ajax.php/?myText=&amp;quot; + &amp;quot;sdfsfd&amp;quot; + &amp;quot;&amp;amp;time=&amp;quot; + SysInfo(10), &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, done)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Where to put your PHP files ===&lt;br /&gt;
&lt;br /&gt;
For development, put the PHP files for your project right in your project folder. You can then use any text editor that you have installed on your system to edit them.&lt;br /&gt;
&lt;br /&gt;
Next, add the file names to the manifest in Project Properties. When you do a Full Deploy, they will be copied to the server with the rest of your project.&lt;br /&gt;
&lt;br /&gt;
The result is that your PHP files will be placed on the server, in the same folder as your app. Your app can call a PHP script by just giving the file name - no path name will be needed.&lt;br /&gt;
&lt;br /&gt;
=== Using JSONP to get a Stock Quote ===&lt;br /&gt;
&lt;br /&gt;
Working with [[Ajax]], we have run into the Same Origin Policy over and over again. In this post, we&#039;ll show you another way to get around it. The Same Origin Policy restricts you from loading files from a server not your own. There is an exception: JavaScript (.js) files are allowed. There are sites on the web where you can request information and have it passed back in JSONP format. The &amp;quot;P&amp;quot; stands for padding: JSONP is JSON with padding. The results are returned as a function call, with the results as parameters. That function can then be called in your program.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s use this to get a stock quote from Yahoo. There are 3 parts to this: first, we have to make the request. Next, we handle the return. Finally, we execute the function.&lt;br /&gt;
&lt;br /&gt;
==== Make the request ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Dim YQI, URL, callback&lt;br /&gt;
 YQI = encodeURIComponent(&amp;quot;select * from yahoo.finance.quotes where symbol in (&#039;AAPL&#039;,&#039;GOOG&#039;,&#039;MSFT&#039;)&amp;quot;)&lt;br /&gt;
 callback=&amp;quot;requestComplete&amp;quot;&lt;br /&gt;
 URL = &amp;quot;http://query.yahooapis.com/v1/public/yql?q=&amp;quot; &amp;amp; YQI &amp;amp; _&lt;br /&gt;
       &amp;quot;&amp;amp;format=json&amp;amp;env=http://datatables.org/alltables.env&amp;amp;callback=&amp;quot; &amp;amp; callback&lt;br /&gt;
 loadScript(URL)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Yahoo! has a very powerful API to look up all kinds of data. To make it easier, they have set up an interface using SQL like statements called YQI. In our code above, we start by creating our YQI request. The [[EncodeURIComponent/decodeURIComponent|encodeURIComponent]]() function translates special characters and spaces so they can be sent in our Ajax call.&lt;br /&gt;
&lt;br /&gt;
URL is then composed of our YQI request with the rest of the boilerplate that is needed. The most interesting part is the &amp;amp;callback part. It names the function that the return values will be wrapped in.&lt;br /&gt;
&lt;br /&gt;
Having prepared everything, we can inject the script.&lt;br /&gt;
&lt;br /&gt;
==== Inject the script ====&lt;br /&gt;
&lt;br /&gt;
Yahoo! is going to return some code: it will be a call to the function we specified in callback, with the parameters all filled in. The following code will insert the code returned by Yahoo! into our program and execute it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function loadScript(JSONP)&lt;br /&gt;
  Dim head, script&lt;br /&gt;
  head=document.getElementsByTagName(&amp;quot;head&amp;quot;)[0]&lt;br /&gt;
  script=document.createElement(&amp;quot;script&amp;quot;)&lt;br /&gt;
  script.src= JSONP&lt;br /&gt;
  script.async=True&lt;br /&gt;
  head.appendChild(script)&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We do the usual checking to see if the call is complete. If it is, we will have gotten a text string back that looks something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
requestComplete({&amp;quot;query&amp;quot;:&lt;br /&gt;
  {&amp;quot;count&amp;quot;:3,&amp;quot;created&amp;quot;:&amp;quot;2012-03-20T11:34:00Z&amp;quot;,&amp;quot;lang&amp;quot;:&amp;quot;en-US&amp;quot;,&amp;quot;results&amp;quot;:&lt;br /&gt;
     {&amp;quot;quote&amp;quot;:...);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a valid function call, so when it is run, the function is executed.&lt;br /&gt;
&lt;br /&gt;
==== Execute the function ====&lt;br /&gt;
&lt;br /&gt;
The Eval() function causes requestComplete() to be called.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function requestComplete(data)&lt;br /&gt;
  Dim quotes, i&lt;br /&gt;
  quotes=data.query.results.quote&lt;br /&gt;
  TextArea1.value=&amp;quot;&amp;quot;&lt;br /&gt;
  For i=0 To Len(quotes)-1&lt;br /&gt;
    TextArea1.value=TextArea1.value+quotes[i].symbol &amp;amp; quotes[i].Ask &amp;amp; vbCRLF&lt;br /&gt;
  Next&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The data that comes back is a fairly complex structure with a lot of data in it. You can copy it to the NotePad to see everything that is there. For now, we are just interested in the asking price of the stock. The results are returned in an array, with one element per stock.&lt;br /&gt;
&lt;br /&gt;
=== Cool things you can get on the web ===&lt;br /&gt;
&lt;br /&gt;
There are many web services that work in a similar fashion. One of the tip offs is if the calling string has an &amp;amp;callback argument. If it does, it probably can be used with this method.&lt;br /&gt;
&lt;br /&gt;
Some of these services are free or limited, while others require an API key that you must obtain from the service.&lt;br /&gt;
&lt;br /&gt;
Some places to go for services:&lt;br /&gt;
&lt;br /&gt;
* The master list is here: [http://www.programmableweb.com Programmable Web]&lt;br /&gt;
* Lots of stuff: [http://developer.yahoo.com/javascript/ Yahoo]!&lt;br /&gt;
* Weather: [http://www.wunderground.com/weather/api/d/docs Wunderground]&lt;br /&gt;
* Elevation: [http://www.geonames.org/export/JSON-webservices.html Geonames]&lt;br /&gt;
* Geographic Info: [http://www.geonames.org/export/JSON-webservices.html Geonames]&lt;br /&gt;
&lt;br /&gt;
Got more? Let us know at support@nsbasic.com.&lt;br /&gt;
&lt;br /&gt;
=== Zip Code Lookup ===&lt;br /&gt;
&lt;br /&gt;
Ever realize, when getting a user&#039;s address, that knowing the zip code makes asking for the city and state unnecessary? Here&#039;s some simple code to look up the city and state from a zip code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zip=&amp;quot;90210&amp;quot;&lt;br /&gt;
&lt;br /&gt;
req=Ajax(&amp;quot;http://zip.elevenbasetwo.com?zip=&amp;quot; &amp;amp; zip)&lt;br /&gt;
If req.status=200 Then &#039;success&lt;br /&gt;
    MsgBox req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    MsgBox &amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
End If&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The result is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&amp;quot;country&amp;quot;: &amp;quot;US&amp;quot;, &amp;quot;state&amp;quot;: &amp;quot;CA&amp;quot;, &amp;quot;city&amp;quot;: &amp;quot;BEVERLY HILLS&amp;quot;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Cross Origin Resource Sharing ===&lt;br /&gt;
&lt;br /&gt;
A lot of the discussion in this Tech Note has been ways to get around Same Origin Policies. Can we get rid of this restriction? We can, but there&#039;s a catch.&lt;br /&gt;
To allow a PHP script on your server to give its results to apps which were not loaded from your server, add this line as the first line of your script.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
header(&#039;Access-Control-Allow-Origin: *&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The catch is that now anyone with an internet connection can run your PHP script.&lt;br /&gt;
&lt;br /&gt;
=== Using AJAX to send an email ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Contributed by Graham Barlow, New Zealand&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The AppStudio Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  EmailText = EmailText &amp;amp; vbCRLF &amp;amp; &amp;quot;Date: &amp;quot; &amp;amp; FormatDateTime(Date,&amp;quot;dd/mm/yy&amp;quot;)&lt;br /&gt;
  Url = &amp;quot;/ajaxEmailRegister.php/?EmailTo=gotnomates@farmmates.com&amp;quot;&lt;br /&gt;
  req=Ajax(Url,&amp;quot;POST&amp;quot;,EmailText)&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    MsgBox(&amp;quot;Confirmation email sent.&amp;quot;)&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    MsgBox(&amp;quot;Error sending email &amp;quot; &amp;amp; req.err)&lt;br /&gt;
  End If&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and the PHP script that gets called (&amp;quot;ajaxEmailRegister.php&amp;quot;):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  // Get the data from the client.&lt;br /&gt;
  $myText = file_get_contents(&#039;php://input&#039;);&lt;br /&gt;
  $to = $_GET[&#039;EmailTo&#039;];&lt;br /&gt;
  $subject = &amp;quot;New Mate registration confirmation&amp;quot;;&lt;br /&gt;
  $body = $myText;&lt;br /&gt;
  $headers = &amp;quot;From: gotnomates@farmmates.com&amp;quot;;&lt;br /&gt;
  mail($to, $subject, $body, $headers);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using AJAX to get info from a database on your server. ===&lt;br /&gt;
&lt;br /&gt;
Since AppStudio runs on your device, it cannot directly access files or databases on another computer, such as a server. It need to communicate with an app running on the server, which gets the information from the database and returns it.&lt;br /&gt;
&lt;br /&gt;
PHP has built in support for MySQL, Oracle and SQLite. If you have a database on your server, it&#039;s easy to query it and return the result to your app. Here&#039;s a very simple example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
$host = &amp;quot;localhost&amp;quot;;&lt;br /&gt;
$databasename = &amp;quot;myDatabaseName&amp;quot;;&lt;br /&gt;
$username =&amp;quot;myUsername&amp;quot;;&lt;br /&gt;
$password = &amp;quot;myPassword&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
$con = mysql_connect($host,$username,$password) or die(mysql_error());&lt;br /&gt;
mysql_select_db($databasename) or die(mysql_error());&lt;br /&gt;
$query = file_get_contents(&amp;quot;php://input&amp;quot;); &lt;br /&gt;
$results = mysql_query($query);&lt;br /&gt;
&lt;br /&gt;
if (mysql_errno()) { &lt;br /&gt;
  header(&amp;quot;HTTP/1.1 500 Internal Server Error&amp;quot;);&lt;br /&gt;
  echo $query.&#039;\n&#039;;&lt;br /&gt;
  echo mysql_error(); &lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
  $rows = array();&lt;br /&gt;
  while($r = mysql_fetch_assoc($results)) {&lt;br /&gt;
    $rows[] = $r;&lt;br /&gt;
  }&lt;br /&gt;
  echo json_encode($rows);&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a link to an article showing how to do the same thing to Access:&lt;br /&gt;
&lt;br /&gt;
http://phpmaster.com/using-an-access-database-with-php/&lt;br /&gt;
&lt;br /&gt;
and Oracle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;http://www.php.net/manual/en/book.oci8.php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You&#039;ll want to address security with this. There is no parsing of the incoming query string, so someone could conceivably put some malicious code in there (&amp;quot;[http://en.wikipedia.org/wiki/SQL_injection SQL Injection]&amp;quot;) and you may want to determine that the person requesting the info is authorized to do so.&lt;br /&gt;
&lt;br /&gt;
For a more detailed description, see this article: http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s XKCD&#039;s comment on this:&lt;br /&gt;
&lt;br /&gt;
[[File:Exploits of a mom.png]]&lt;br /&gt;
&lt;br /&gt;
=== Using AJAX to get save a picture to your server ===&lt;br /&gt;
&lt;br /&gt;
See the sample &amp;quot;CameraToServer&amp;quot;, contributed by Mike Miller jdmdude2009@gmail.com&lt;br /&gt;
&lt;br /&gt;
This sample lets you get a picture from the camera or the Photo Library&lt;br /&gt;
and display it on your screen and:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Push it to a web server in base64 or PNG format using an AJAX POST&lt;br /&gt;
&amp;lt;li&amp;gt;Receive a response from the server and do something with it.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
This is a mod of the original Camera Sample file.&lt;br /&gt;
You must have the supplied PHP files in the same location&lt;br /&gt;
as the AppStudio production files.&lt;br /&gt;
&lt;br /&gt;
To control when a pic may be sent or that a pic is not sent&lt;br /&gt;
multiple times by click happy users, btnSubmitImages is placed&lt;br /&gt;
in different states of visiblility and/or usability by way of the &lt;br /&gt;
SentFlag.&lt;br /&gt;
&lt;br /&gt;
Note: PictureBox1 is in the negative left of the form.&lt;br /&gt;
This is a trick that developers use to hide controls&lt;br /&gt;
from the users but still have availability to them.&lt;br /&gt;
&lt;br /&gt;
Image1 is used for preview ONLY because viewing PictureBox1&lt;br /&gt;
isn&#039;t very realistic for viewing because it exceeds the &lt;br /&gt;
mobile screen size. (You can size the PictureBox to any size&lt;br /&gt;
a camera is capable of, but beware, size does matter! The lag&lt;br /&gt;
to insert an image into a db gets longer as the pics get larger.&lt;br /&gt;
I also noticed phpmyadmin is not very responsive to large images AND&lt;br /&gt;
I have had timeouts when loading pages with lots of images. I suspect&lt;br /&gt;
some sort of slide presentation tool that controls the load of&lt;br /&gt;
the images will be in order to view large quantities of photos&lt;br /&gt;
(lot&#039;s of opensource for slide views)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; &amp;gt;&lt;br /&gt;
(the source code of the program)&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dim e&lt;br /&gt;
Dim SentFlag&lt;br /&gt;
&lt;br /&gt;
reader = new FileReader()&lt;br /&gt;
img=new Image()&lt;br /&gt;
SentFlag=0&lt;br /&gt;
&lt;br /&gt;
Sub Main()&lt;br /&gt;
  pb=PictureBox1.getContext(&amp;quot;2d&amp;quot;)&lt;br /&gt;
  SetTimeout(window.scrollTo(0,window.innerHeight),100)&lt;br /&gt;
  btnSubmitImage.value=&amp;quot;&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Function txtGetPicture_onchange()&lt;br /&gt;
  &#039;This gets called after the picture is chosen. &lt;br /&gt;
  &#039;Next, let&#039;s read start reading it in.&lt;br /&gt;
  &#039;The _onload function will be called when that completes.&lt;br /&gt;
  reader.readAsDataURL(txtGetPicture.files[0])&lt;br /&gt;
  e=event&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function reader_onload(e)&lt;br /&gt;
  &#039;read of the file is complete.&lt;br /&gt;
  &#039;Now, let&#039;s load it into an image.&lt;br /&gt;
  &#039;The _onload function for the image will be called on completion.&lt;br /&gt;
  img.src=e.target.result&lt;br /&gt;
  Image1.firstChild.src=e.target.result &#039;Phone Viewing ONLY&lt;br /&gt;
  SentFlag=0&lt;br /&gt;
  btnSubmitImage.hidden=False&lt;br /&gt;
  btnSubmitImage.value=&amp;quot;Send Image to Web&amp;quot;&lt;br /&gt;
  lblPicMsg.textContent=&amp;quot;Now is the time&amp;quot;&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function img_onload()&lt;br /&gt;
  &#039;image is now loaded. Let&#039;s add it to the PictureBox2 and scale&lt;br /&gt;
 &lt;br /&gt;
  &#039;PictureBox1 is very large here and takes a while for the image&lt;br /&gt;
  &#039;to transfer to the web server (approx 1MB)&lt;br /&gt;
  &#039;still no solution it the iOS distortion.&lt;br /&gt;
  pb.drawImage(img,0,0,PictureBox1.width,PictureBox1.Height)&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function PostToWebServer()&lt;br /&gt;
  Dim devInfo&lt;br /&gt;
  Dim postData&lt;br /&gt;
  &lt;br /&gt;
  SentFlag=1 &#039;Don&#039;t allow multiple submissions because the button&lt;br /&gt;
             &#039;is pushed more than once.&lt;br /&gt;
  &lt;br /&gt;
  &#039;Get divice information - not available &lt;br /&gt;
  devInfo=&amp;quot;No device selected&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  &#039;Build POST  &lt;br /&gt;
  postData = &amp;quot;filename=&amp;quot; &amp;amp; txtGetPicture.files[0].name&lt;br /&gt;
  postData = postData &amp;amp; &amp;quot;&amp;amp;deviceInfo=&amp;quot; &amp;amp; devInfo &lt;br /&gt;
  postData = postData &amp;amp; &amp;quot;&amp;amp;imgBase64=&amp;quot; &amp;amp; PictureBox1.toDataURL()&lt;br /&gt;
  &lt;br /&gt;
  &#039;Send POST to server&lt;br /&gt;
  req=Ajax(&amp;quot;insertimage.php&amp;quot;,&amp;quot;POST&amp;quot;,postData) &lt;br /&gt;
&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    btnSubmitImage.hidden=True &#039;Picture was pushed to server so hide button&lt;br /&gt;
    lblPicMsg.textContent =  &amp;quot;Success!!!&amp;quot;&lt;br /&gt;
    htmResponse.innerHTML=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    htmResponse.innerHTML=&amp;quot;Error: &amp;quot; &amp;amp; req.err&lt;br /&gt;
    btnSubmitImage.hidden=False&lt;br /&gt;
    lblPicMsg.textContent =  &amp;quot;Failure&amp;quot;&lt;br /&gt;
    SentFlag=0&lt;br /&gt;
  End If&lt;br /&gt;
&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function btnSubmitImage_onclick()&lt;br /&gt;
  If Len(PictureBox1.toDataURL())&amp;gt;0 And SentFlag=0 Then&lt;br /&gt;
      btnSubmitImage.value = &amp;quot;Sending&amp;quot;&lt;br /&gt;
      lblPicMsg.textContent = &amp;quot;Please Wait&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
    &#039;Use the SetTimout function to call a procedure OUTSIDE&lt;br /&gt;
    &#039;this onclick event so that any events that need to &lt;br /&gt;
    &#039;occur on submission are not held up by the size of the&lt;br /&gt;
    &#039;image or the speed of the internet connection.&lt;br /&gt;
    &#039;(i.e. the btn value change and the label caption change.  &lt;br /&gt;
    SetTimeout(PostToWebServer,3000) &#039;POST TO WEB&lt;br /&gt;
    &lt;br /&gt;
  Else&lt;br /&gt;
      lblPicMsg.textContent =  &amp;quot;Need to take a pic first&amp;quot;&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using AJAX to get all kinds of stuff on the web ===&lt;br /&gt;
&lt;br /&gt;
Many websites have information that can be retrieved using AJAX. The best list we have found is on [http://www.programmableweb.com Programmable Web].&lt;br /&gt;
&lt;br /&gt;
=== Using Ajax with PhoneGap ===&lt;br /&gt;
&lt;br /&gt;
When running as a PhoneGap app, your program is no longer tied to the server it was downloaded from. As a result, it doesn&#039;t know where to go on the web. You need to make two changes to any of the above samples to make them work as PhoneGap apps.&lt;br /&gt;
&lt;br /&gt;
1. Declare the website you want to access in the PhoneGap configxml property (in Project Properties), by adding this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;access origin=&amp;quot;https://www.nsbasic.com&amp;quot; subdomains=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(substitute the URL to your site which has the script on it).&lt;br /&gt;
&lt;br /&gt;
2. Use the full path to the script in your Ajax call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  req=Ajax(&amp;quot;https://www.nsbasic.com/i/Ajax/ajax.php/?myText=&amp;quot; + encodeURIComponent(txtSend.value))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Again, substitute the path to your script - don&#039;t use this one!)&lt;br /&gt;
&lt;br /&gt;
=== Using Ajax with ASP.NET ===&lt;br /&gt;
&lt;br /&gt;
Everything is pretty much the same on the AppStudio side. Here&#039;s how it looks on the server side. (Thanks to John Cody!)&lt;br /&gt;
&lt;br /&gt;
1) Make sure this entry is in your asp.net webservice&#039;s web.config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;webServices&amp;gt;&lt;br /&gt;
      &amp;lt;protocols&amp;gt;&lt;br /&gt;
        &amp;lt;add name=&amp;quot;HttpPost&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/protocols&amp;gt;&lt;br /&gt;
    &amp;lt;/webServices&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) ASP.NET VB code (i.e Service.asmx file):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Imports System.Web.Services&lt;br /&gt;
 Imports System.Web.Services.Protocols&lt;br /&gt;
 Imports System.ComponentModel&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;System.Web.Services.WebService(Namespace:=&amp;quot;http://tempuri.org/&amp;quot;)&amp;gt; _&lt;br /&gt;
 &amp;lt;System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&amp;gt; &amp;lt;ToolboxItem(False)&amp;gt; _&lt;br /&gt;
 Public Class WebService&lt;br /&gt;
     Inherits System.Web.Services.WebService&lt;br /&gt;
     &amp;lt;WebMethod()&amp;gt; _&lt;br /&gt;
     Public Function HelloWorld(Token as string) As String&lt;br /&gt;
         &#039;the var Token has the string that was send from the AppStudio app&lt;br /&gt;
         Return &amp;quot;Hello World&amp;quot;&lt;br /&gt;
     End Function&lt;br /&gt;
 End Class&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) AppStudio code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Dim req&lt;br /&gt;
&lt;br /&gt;
 Function cmdSend_onclick()&lt;br /&gt;
    req = Ajax(&amp;quot;http://mywebsite.com/Service.asmx/HelloWorld&amp;quot;,&amp;quot;POST&amp;quot;,&amp;quot;token=&amp;amp;Test123&amp;quot;, send_return)&lt;br /&gt;
 End Function&lt;br /&gt;
&lt;br /&gt;
 Function send_return()&lt;br /&gt;
    Dim Res&lt;br /&gt;
    If req.readyState &amp;lt;&amp;gt; 4 Then Exit Function &#039;ignore progress reports&lt;br /&gt;
    If req.status = 200 Then &#039;succes&lt;br /&gt;
       Res = req.responseTex&lt;br /&gt;
       &#039;Res has &amp;quot;Hello World&amp;quot; in it, but it is in XML/UTF-8 format and needs to be decoded&lt;br /&gt;
    Else&lt;br /&gt;
       &#039;some error&lt;br /&gt;
       End If&lt;br /&gt;
 End Function&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Asynchronous_Calls&amp;diff=6163</id>
		<title>Asynchronous Calls</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Asynchronous_Calls&amp;diff=6163"/>
		<updated>2014-07-14T21:18:08Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Using Ajax Asynchronously ==&lt;br /&gt;
&lt;br /&gt;
In our last Ajax discussion, we discovered that it could take half a second for an [[Ajax]] call to complete (actually, due to network latency, it could even be a lot more than that.) How do we do [[Ajax]] calls and not make our app look slow?&lt;br /&gt;
&lt;br /&gt;
Easy. We send the Ajax message off, then go do other stuff. When the response comes back, we respond to it. This is called Asynchronous operation.&lt;br /&gt;
&lt;br /&gt;
We do this by adding the name of the function to be called on completion as the 4th parameter of our [[Ajax]] call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
req=Ajax(&amp;quot;ajax.php/?myText=&amp;quot; + txtSend.value, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, done)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Our callback function is called &#039;done&#039;. After we execute the Ajax call, the program goes on to the next statement in the program immediately. It doesn&#039;t wait for any response. We can update the screen, or wait for the user to do something else. When the reply comes back, our &#039;done&#039; function will be called:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dim req&lt;br /&gt;
&lt;br /&gt;
Function btnAjax_onclick()&lt;br /&gt;
  req=Ajax(&amp;quot;ajax.php/?myText=&amp;quot; + txtSend.value, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, done)&lt;br /&gt;
  txtResponse.value=&amp;quot;Waiting for result.&amp;quot;&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function done()&lt;br /&gt;
  If req.readyState&amp;lt;&amp;gt;4 Then Exit Function &#039;ignore progress reports&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    txtResponse.value=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    txtResponse.value=&amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;done&#039; will actually be called several times with progress reports on the call. We only care if it completes, so we wait for req.readyState to be 4. The rest of our function works just like when we were not asynchronous.&lt;br /&gt;
&lt;br /&gt;
One of the uses of this technique that we see every day is to return partial results on a search field (as in Google). Each time a character is entered, it is sent to the server for a list of possible matches. As the results come back, the window is updated. Entering characters in the field is unaffected by the server communications that are going on at the same time.&lt;br /&gt;
&lt;br /&gt;
Check out the AjaxAsync app in the Samples to see this in action.&lt;br /&gt;
&lt;br /&gt;
== Using JSONP to get a Stock Quote ==&lt;br /&gt;
&lt;br /&gt;
Working with [[Ajax]], we have run into the [http://en.wikipedia.org/wiki/Same-origin_policy Same Origin Policy] over and over again. In this post, we&#039;ll show you another way to get around it. The Same Origin Policy restricts you from loading files from a server not your own. There is an exception: JavaScript (.js) files are allowed. There are sites on the web where you can request information and have it passed back in [http://en.wikipedia.org/wiki/JSONP JSONP] format. The &amp;quot;P&amp;quot; stands for padding: JSONP is JSON with padding. The results are returned as a function call, with the results as parameters. That function can then be called in your program.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s use this to get a stock quote from Yahoo. There are 3 parts to this: first, we have to make the request. Next, we handle the return. Finally, we execute the function.&lt;br /&gt;
&lt;br /&gt;
==== Make the request ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Dim YQI, URL, callback&lt;br /&gt;
 YQI = encodeURIComponent(&amp;quot;select * from yahoo.finance.quotes where symbol in (&#039;AAPL&#039;,&#039;GOOG&#039;,&#039;MSFT&#039;)&amp;quot;)&lt;br /&gt;
 callback=&amp;quot;requestComplete&amp;quot;&lt;br /&gt;
 URL = &amp;quot;http://query.yahooapis.com/v1/public/yql?q=&amp;quot; &amp;amp; YQI &amp;amp; _&lt;br /&gt;
       &amp;quot;&amp;amp;format=json&amp;amp;env=http://datatables.org/alltables.env&amp;amp;callback=&amp;quot; &amp;amp; callback&lt;br /&gt;
 loadScript(URL)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Yahoo! has a very powerful API to look up all kinds of data. To make it easier, they have set up an interface using SQL like statements called YQI. In our code above, we start by creating our YQI request. The [[EncodeURIComponent/decodeURIComponent|encodeURIComponent]]() function translates special characters and spaces so they can be sent in our Ajax call.&lt;br /&gt;
&lt;br /&gt;
URL is then composed of our YQI request with the rest of the boilerplate that is needed. The most interesting part is the &amp;amp;callback part. It names the function that the return values will be wrapped in.&lt;br /&gt;
&lt;br /&gt;
Having prepared everything, we can inject the script.&lt;br /&gt;
&lt;br /&gt;
==== Inject the script ====&lt;br /&gt;
&lt;br /&gt;
Yahoo! is going to return some code: it will be a call to the function we specified in callback, with the parameters all filled in. The following code will insert the code returned by Yahoo! into our program and execute it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function loadScript(URL)&lt;br /&gt;
  Dim head, script&lt;br /&gt;
  head=document.getElementsByTagName(&amp;quot;head&amp;quot;)[0]&lt;br /&gt;
  script=document.createElement(&amp;quot;script&amp;quot;)&lt;br /&gt;
  script.src=URL&lt;br /&gt;
  script.async=True&lt;br /&gt;
  head.appendChild(script)&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We do the usual checking to see if the call is complete. If it is, we will have gotten a text string back that looks something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
requestComplete({&amp;quot;query&amp;quot;:&lt;br /&gt;
  {&amp;quot;count&amp;quot;:3,&amp;quot;created&amp;quot;:&amp;quot;2012-03-20T11:34:00Z&amp;quot;,&amp;quot;lang&amp;quot;:&amp;quot;en-US&amp;quot;,&amp;quot;results&amp;quot;:&lt;br /&gt;
     {&amp;quot;quote&amp;quot;:...);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a valid function call, so when it is run, the function is executed.&lt;br /&gt;
&lt;br /&gt;
==== Execute the function ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function requestComplete(data)&lt;br /&gt;
  Dim quotes, i&lt;br /&gt;
  quotes=data.query.results.quote&lt;br /&gt;
  TextArea1.value=&amp;quot;&amp;quot;&lt;br /&gt;
  For i=0 To Len(quotes)-1&lt;br /&gt;
    TextArea1.value=TextArea1.value+quotes[i].symbol &amp;amp; quotes[i].Ask &amp;amp; vbCRLF&lt;br /&gt;
  Next&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The data that comes back is a fairly complex structure with a lot of data in it. You can copy it to the NotePad to see everything that is there. For now, we are just interested in the asking price of the stock. The results are returned in an array, with one element per stock.&lt;br /&gt;
&lt;br /&gt;
=== Cool things you can get on the web ===&lt;br /&gt;
&lt;br /&gt;
There are many web services that work in a similar fashion. One of the tip offs is if the calling string has an &amp;amp;callback argument. If it does, it probably can be used with this method.&lt;br /&gt;
&lt;br /&gt;
Some of these services are free or limited, while others require an API key that you must obtain from the service.&lt;br /&gt;
&lt;br /&gt;
Some places to go for services:&lt;br /&gt;
&lt;br /&gt;
* The master list is here: [http://www.programmableweb.com Programmable Web]&lt;br /&gt;
* Lots of stuff: [http://developer.yahoo.com/javascript/ Yahoo]!&lt;br /&gt;
* Weather: [http://www.wunderground.com/weather/api/d/docs Wunderground]&lt;br /&gt;
* Elevation: [http://www.geonames.org/export/JSON-webservices.html Geonames]&lt;br /&gt;
* Geographic Info: [http://www.geonames.org/export/JSON-webservices.html Geonames]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Escape/unEscape&amp;diff=6162</id>
		<title>Escape/unEscape</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Escape/unEscape&amp;diff=6162"/>
		<updated>2014-07-14T20:57:59Z</updated>

		<summary type="html">&lt;p&gt;James: Adding deprecated note.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Deprecated|newvarlink=encodeURIComponent/decodeURIComponent|newvarname=encodeURIComponent/decodeURIComponent}}&lt;br /&gt;
&lt;br /&gt;
Escape(&#039;&#039;string&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
unEscape(&#039;&#039;string&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Escape returns a string with all special characters turned into a % character followed by the hex value of the character.&lt;br /&gt;
&lt;br /&gt;
unEscape converts a string with special characters turned into a normal string.&lt;br /&gt;
&lt;br /&gt;
== Example (Basic) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Print Escape(&amp;quot;ABC!@#$%&amp;quot;)&lt;br /&gt;
Print UnEscape(&amp;quot;ABC%0d%0aDEF&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example (JavaScript) ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NSB.Print(escape(&amp;quot;ABC!@#$%&amp;quot;));&lt;br /&gt;
NSB.Print(unescape(&amp;quot;ABC%0d%0aDEF&amp;quot;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Output ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ABC%21@%23%24%25&lt;br /&gt;
ABC&lt;br /&gt;
DEF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Items ==&lt;br /&gt;
&lt;br /&gt;
[[encodeURI/decodeURI|encodeURI]], [[encodeURI/decodeURI|decodeURI]], [[encodeURIComponent/decodeURIComponent|encodeURIComponent]], [[encodeURIComponent/decodeURIComponent|decodeURIComponent]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language Reference]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Variable Handling]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Template:Deprecated&amp;diff=6161</id>
		<title>Template:Deprecated</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Template:Deprecated&amp;diff=6161"/>
		<updated>2014-07-14T20:55:59Z</updated>

		<summary type="html">&lt;p&gt;James: Updated with styles from mediawiki.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;margin: 4px 10%; border: 2px solid #b22222; border-collapse: collapse; background: #f9f9f9;&amp;quot;&lt;br /&gt;
| style=&amp;quot;border: none; padding: 2px 0 2px 0.9em; text-align: center;&amp;quot; | [[File:Imbox deletion.png]]&lt;br /&gt;
| style=&amp;quot;border: none; padding: 0.25em 0.9em; width: 100%;&amp;quot; | &#039;&#039;&#039;This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Please see &#039;&#039;&#039;[[{{{newvarlink}}}|{{{newvarname}}}]]&#039;&#039;&#039; for an alternative way to use this feature.&#039;&#039;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Imbox_deletion.png&amp;diff=6160</id>
		<title>File:Imbox deletion.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Imbox_deletion.png&amp;diff=6160"/>
		<updated>2014-07-14T20:46:23Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Template:Deprecated&amp;diff=6158</id>
		<title>Template:Deprecated</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Template:Deprecated&amp;diff=6158"/>
		<updated>2014-07-14T20:13:17Z</updated>

		<summary type="html">&lt;p&gt;James: James moved page Template:Mbox to Template:Deprecated: I really just needed a deprecated template. I guess I&amp;#039;m going to do it the hard way.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke:Message box|mbox}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Template:Deprecated&amp;diff=6157</id>
		<title>Template:Deprecated</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Template:Deprecated&amp;diff=6157"/>
		<updated>2014-07-14T20:05:16Z</updated>

		<summary type="html">&lt;p&gt;James: Creating... not sure if this will work.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke:Message box|mbox}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Ajax_made_Simple&amp;diff=6156</id>
		<title>Ajax made Simple</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Ajax_made_Simple&amp;diff=6156"/>
		<updated>2014-07-14T19:48:21Z</updated>

		<summary type="html">&lt;p&gt;James: Adding encodeURIComponent and changing from escape to encodeURIComponent.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Most developers have heard of Ajax by now. Unless you&#039;ve worked with it, you probably think it&#039;s another complicated form of alphabet soup. It actually turns out to be quite easy to use from AppStudio.&lt;br /&gt;
&lt;br /&gt;
First, let&#039;s explain what it is (and isn&#039;t). It stands for [http://en.wikipedia.org/wiki/Ajax_(programming) Asynchronous JavaScript And XML]. The good news is that there&#039;s no need to be asynchronous or to use XML - and that AppStudio takes care of the JavaScript.&lt;br /&gt;
&lt;br /&gt;
[[Ajax]] makes it easy to exchange data with your server. Think of it as a function you can call that is running on another system. You can pass it parameters and it can return values. Since it&#039;s running on your server, it can do things that you cannot do on your device. It can access files and databases on the server, or get data from other web sites without worrying about [http://en.wikipedia.org/wiki/Same_origin_policy Same Origin Policies].&lt;br /&gt;
&lt;br /&gt;
You will need to use a server with PHP enabled to run these samples. The nsbapp.com site does not have PHP enabled.&lt;br /&gt;
&lt;br /&gt;
=== A Simple Exchange of Data with the server ===&lt;br /&gt;
&lt;br /&gt;
Let&#039;s look at some code. We will have our AppStudio app send the server a string, which the server will return reversed. Here is what the app looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:Ajax1.jpg]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The only code in this app is the &amp;quot;Reverse&amp;quot; button. The [[Ajax]] function sends the contents of the top textarea to a PHP script that is running on the server. If it returns successfully, we display what came back. Otherwise, we show the error:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dim req&lt;br /&gt;
Function btnAjax_onclick()&lt;br /&gt;
  req=Ajax(&amp;quot;ajax.php/?myText=&amp;quot; &amp;amp; encodeURIComponent(txtSend.value))&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    txtResponse.value=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    txtResponse.value=&amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The PHP script is even easier. It gets the input that is named myText, reverses it, and uses the echo statement to send it back.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
 // Get the data from the client. &lt;br /&gt;
 $myText = $_GET[&#039;myText&#039;];&lt;br /&gt;
 // Send back the text, reversed&lt;br /&gt;
 echo &amp;quot;Data received from Device (reversed): &amp;quot; . strrev($myText); &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here is the result:&lt;br /&gt;
&lt;br /&gt;
[[File:Ajax2.jpg]]&lt;br /&gt;
&lt;br /&gt;
A few notes:&lt;br /&gt;
&lt;br /&gt;
* The php script needs to be on the same folder on the server as the AppStudio app.&lt;br /&gt;
* [[Ajax]] is based on XMLHttpPost.&lt;br /&gt;
* A handy way to return data from your PHP script is in [http://blog.nsbasic.com/?p=425 JSON] format. PHP even has a handy json_encode() function.&lt;br /&gt;
* PHP is not enabled on the nsbapp.com server.&lt;br /&gt;
&lt;br /&gt;
=== Using POST to Send more Data to the Server ===&lt;br /&gt;
&lt;br /&gt;
Let&#039;s extend what we are doing a bit and talk about using the POST method.&lt;br /&gt;
&lt;br /&gt;
We discussed the simplest [[Ajax]] call, which sends data to the server by adding it to the end of the URL, a method called, rather misleadingly, GET. But what if we want to send more data? GET has a limit, some say, of around 2000 characters. For more than that, we&#039;ll use the also badly named POST method. POST has an upload limit on most servers of 8 megabytes. If you need more, server settings can be adjusted.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s look at some code. You&#039;ll see it looks very much like our last post:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function btnAjax_onclick()&lt;br /&gt;
  req=Ajax(&amp;quot;ajaxPost.php&amp;quot;,&amp;quot;POST&amp;quot;,txtSend.value)&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    htmResponse.innerHTML=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    htmResponse.innerHTML=&amp;quot;Error: &amp;quot; &amp;amp; req.err&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The difference is a couple of extra parameters. We add &amp;quot;POST&amp;quot; and the data we want to send as a separate parameter. Before we talk about what is going to happen at the server end, let&#039;s see what the app looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:Ajaxpost.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
OK, here is the PHP code on the server which we are calling:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
 // uncomment the next line to see runtime error messages from this script&lt;br /&gt;
 // ini_set(&#039;display_errors&#039;,&#039;1&#039;);&lt;br /&gt;
 &lt;br /&gt;
 // Get the data from the client.&lt;br /&gt;
 $myText = file_get_contents(&#039;php://input&#039;);&lt;br /&gt;
 // Send back the text, reversed&lt;br /&gt;
 echo &amp;quot;Data received from Device (reversed):&amp;lt;br&amp;gt;&amp;quot; . strrev($myText); &lt;br /&gt;
 &lt;br /&gt;
 //write the data out to a file on the server&lt;br /&gt;
 //make sure permissions are all OK!&lt;br /&gt;
 $myFile = &amp;quot;AjaxPost/ajaxPost.txt&amp;quot;;&lt;br /&gt;
 echo &amp;quot;&amp;lt;p&amp;gt;Writing data to &amp;quot; . getcwd() . $myFile;&lt;br /&gt;
 $f = fopen($myFile, &#039;w&#039;) or die(&amp;quot;can&#039;t open file&amp;quot;);&lt;br /&gt;
 fwrite($f, $myText);&lt;br /&gt;
 fclose($f);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The file_get_contents(&#039;php://input&#039;) call gets the data, exactly as it was sent. We&#039;ll do two things with it: echo it back reversed and we will write it to a file on the server. The first part is easy: anything in an echo statement is sent back to our app:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;Data received from Device (reversed):&amp;quot; . strrev($myText); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second part involves a bit more PHP, but is straightforward. It writes the data was received to a file.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
$myFile = &amp;quot;AjaxPost/ajaxPost.txt&amp;quot;;&lt;br /&gt;
 echo &amp;quot;&amp;lt;p&amp;gt;Writing data to &amp;quot; . getcwd() . $myFile;&lt;br /&gt;
 $f = fopen($myFile, &#039;w&#039;) or die(&amp;quot;can&#039;t open file&amp;quot;);&lt;br /&gt;
 fwrite($f, $myText);&lt;br /&gt;
 fclose($f);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
What would you use this feature for?&lt;br /&gt;
&lt;br /&gt;
* Upload a JSON copy of your database.&lt;br /&gt;
* Upload some pictures in Base64 format.&lt;br /&gt;
* Create a .htm file which can be accessed as a web page.&lt;br /&gt;
* Lots more ideas!&lt;br /&gt;
&lt;br /&gt;
A tip on debugging PHP scripts Since PHP scripts run on the server and not on your screen, you don&#039;t get to see the error messages. This can make debugging difficult. If you put this statement at the top of your PHP script, the error messages will be echoed to your app:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ini_set(&#039;display_errors&#039;,&#039;1&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The error messages come back as HTML formatted text. The best way to look at them is to assign them to the innerText property of an HTMLview control.&lt;br /&gt;
&lt;br /&gt;
=== Getting Data from Another Site ===&lt;br /&gt;
&lt;br /&gt;
One of the basic security features of the modern web is the [http://en.wikipedia.org/wiki/Same_origin_policy Same Origin Policy]. It states that a web app cannot pull up just any data from another site. This becomes a problem if you need data on someone else&#039;s site.&lt;br /&gt;
&lt;br /&gt;
Fortunately, they left an easy workaround. While a web app isn&#039;t allowed to access the files on another site, a PHP script is. We&#039;ll get our PHP script to do the dirty work for us and return the results to our app. The technique we will use is often called [http://en.wikipedia.org/wiki/Web_scraping scraping].&lt;br /&gt;
&lt;br /&gt;
Time to look at some code again. Here&#039;s the AppStudio part that calls the PHP script. It looks very much like the code in A Simple Exchange of Data with the server above. The main difference is that we&#039;re calling a different PHP script.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function btnGetFile_onclick()&lt;br /&gt;
  req=Ajax(&amp;quot;ajaxGetURL.php/?urlToGet=&amp;quot; &amp;amp; encodeURIComponent(txtURL.value))&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    htmResponse.innerHTML=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    htmResponse.innerHTML=req.err&lt;br /&gt;
  End If&lt;br /&gt;
  htmResponse.refresh()&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Before we talk about what is going to happen at the server end, let&#039;s see what the app looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:Ajaxgeturl.png]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And here is what the PHP script looks like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$ch = curl_init($_GET[&#039;urlToGet&#039;]);&lt;br /&gt;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);&lt;br /&gt;
$data = curl_exec($ch);&lt;br /&gt;
curl_close($ch);&lt;br /&gt;
echo $data&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let&#039;s take apart this one line:&lt;br /&gt;
&lt;br /&gt;
* $_GET(&#039;urlToGet&#039;) gets the parameter string that was attached to the URL in our AppStudio code.&lt;br /&gt;
* _file_get_contents get the contents of the file, in this case, the URL that was passed.&lt;br /&gt;
* echo sends the result back to our AppStudio program.&lt;br /&gt;
&lt;br /&gt;
Pretty simple, isn&#039;t it?&lt;br /&gt;
&lt;br /&gt;
(In this example, we&#039;re grabbing the robots.txt file from Microsoft&#039;s site, just to show we can get files from anywhere. Nearly all sites have a robots.txt file: it is used to guide search engines.)&lt;br /&gt;
&lt;br /&gt;
There is a simpler way to do this, but it can run into security problems.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo file_get_contents($_GET[&#039;urlToGet&#039;]); &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How fast is it? ===&lt;br /&gt;
&lt;br /&gt;
If your app is going to communicate with your server while it is running, you&#039;ve probably wondered how much your app will slow down when it has to wait for the server.&lt;br /&gt;
&lt;br /&gt;
In this blog post, we&#039;re going to make a program to test this. We&#039;ll construct a little program which sends data to the server as many times as it can. The server will record the information in a log file. Here is what our app will do:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Do Until SysInfo(10) &amp;gt; limit&lt;br /&gt;
    req=Ajax(&amp;quot;ajaxLog.php/?myText=&amp;quot; + encodeURIComponent(Now))&lt;br /&gt;
    counter=counter+1&lt;br /&gt;
  Loop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
SysInfo(10) is the current time in milliseconds. Limit is the time we want run to. You can run this test for up to about 5 seconds: after that, the system will think you are in a endless loop and shut you down.&lt;br /&gt;
&lt;br /&gt;
On the server side, we need a PHP script to get the messages and write them out to disk. Here&#039;s the code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  // read and append to file&lt;br /&gt;
  $myFile = &amp;quot;AjaxLog/log.txt&amp;quot;;&lt;br /&gt;
  $f = fopen($myFile, &#039;a&#039;) or die(&amp;quot;can&#039;t open file&amp;quot;);&lt;br /&gt;
  fwrite($f, $_GET[&#039;myText&#039;] . Chr(13) . Chr(10));&lt;br /&gt;
  fclose($f);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now, let&#039;s run it on a few different devices and see how many accesses we can do per second:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Desktop (Ethernet) || 2745.0&lt;br /&gt;
|-&lt;br /&gt;
| iPhone 4 (WiFi) || 10.5&lt;br /&gt;
|-&lt;br /&gt;
| iPhone (3G) || 2.5&lt;br /&gt;
|-&lt;br /&gt;
| Nexus S (WiFi) || 5.0&lt;br /&gt;
|-&lt;br /&gt;
| Kindle Fire (WiFi) || 9.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It&#039;s obvious that the speed that really depends on what kind of connection you have to the web. A hard wire to your router gets the best time. WiFi is much slower, and 3G is slower again. No real surprise here.&lt;br /&gt;
&lt;br /&gt;
The speeds shown here probably are not what you will see if you run the same test. There are a number of factors that will affect the speed:&lt;br /&gt;
&lt;br /&gt;
* Type of data connection&lt;br /&gt;
* Load on the network&lt;br /&gt;
* Number of hops the data has to make to get to the server&lt;br /&gt;
* Load on the server&lt;br /&gt;
&lt;br /&gt;
(You can try this sample yourself - it is called AjaxLog in the Samples folder.)&lt;br /&gt;
&lt;br /&gt;
=== Asynchronous Calls ===&lt;br /&gt;
&lt;br /&gt;
In our last Ajax discussion, we discovered that it could take half a second for an [[Ajax]] call to complete (actually, due to network latency, it could even be a lot more than that.) How do we do [[Ajax]] calls and not make our app look slow?&lt;br /&gt;
&lt;br /&gt;
Easy. We send the Ajax message off, then go do other stuff. When the response comes back, we respond to it. This is called Asynchronous operation.&lt;br /&gt;
&lt;br /&gt;
We do this by adding the name of the function to be called on completion as the 4th parameter of our [[Ajax]] call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
req=Ajax(&amp;quot;ajax.php/?myText=&amp;quot; + encodeURIComponent(txtSend.value), &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, done)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Our callback function is called &#039;done&#039;. After we execute the Ajax call, the program goes on to the next statement in the program immediately. It doesn&#039;t wait for any response. We can update the screen, or wait for the user to do something else. When the reply comes back, our &#039;done&#039; function will be called:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function done()&lt;br /&gt;
  If req.readyState&amp;lt;&amp;gt;4 Then Exit Function &#039;ignore progress reports&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    txtResponse.value=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    txtResponse.value=&amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;done&#039; will actually be called several times with progress reports on the call. We only care if it completes, so we wait for req.readyState to be 4. The rest of our function works just like when we were not asynchronous.&lt;br /&gt;
&lt;br /&gt;
One of the uses of this technique that we see every day is to return partial results on a search field (as in Google). Each time a character is entered, it is sent to the server for a list of possible matches. As the results come back, the window is updated. Entering characters in the field is unaffected by the server communications that are going on at the same time.&lt;br /&gt;
&lt;br /&gt;
Check out the AjaxAsync app in the Samples to see this in action.&lt;br /&gt;
&lt;br /&gt;
=== Caching ===&lt;br /&gt;
&lt;br /&gt;
Sometimes when you make the same request repeatedly, you&#039;ll get the same result, even through the data on the server has changed. The browser is &amp;quot;helping&amp;quot; you by delivering the same result from its cache instead of going out to the server again. To fix this, add a time stamp to the query string. This example puts the number of milliseconds into the string:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
req=Ajax(&amp;quot;ajax.php/?myText=&amp;quot; + &amp;quot;sdfsfd&amp;quot; + &amp;quot;&amp;amp;time=&amp;quot; + SysInfo(10), &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, done)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Where to put your PHP files ===&lt;br /&gt;
&lt;br /&gt;
For development, put the PHP files for your project right in your project folder. You can then use any text editor that you have installed on your system to edit them.&lt;br /&gt;
&lt;br /&gt;
Next, add the file names to the manifest in Project Properties. When you do a Full Deploy, they will be copied to the server with the rest of your project.&lt;br /&gt;
&lt;br /&gt;
The result is that your PHP files will be placed on the server, in the same folder as your app. Your app can call a PHP script by just giving the file name - no path name will be needed.&lt;br /&gt;
&lt;br /&gt;
=== Using JSONP to get a Stock Quote ===&lt;br /&gt;
&lt;br /&gt;
Working with [[Ajax]], we have run into the Same Origin Policy over and over again. In this post, we&#039;ll show you another way to get around it. The Same Origin Policy restricts you from loading files from a server not your own. There is an exception: JavaScript (.js) files are allowed. There are sites on the web where you can request information and have it passed back in JSONP format. The &amp;quot;P&amp;quot; stands for padding: JSONP is JSON with padding. The results are returned as a function call, with the results as parameters. That function can then be called in your program.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s use this to get a stock quote from Yahoo. There are 3 parts to this: first, we have to make the request. Next, we handle the return. Finally, we execute the function.&lt;br /&gt;
&lt;br /&gt;
==== Make the request ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Dim YQI, URL, callback&lt;br /&gt;
 YQI = encodeURIComponent(&amp;quot;select * from yahoo.finance.quotes where symbol in (&#039;AAPL&#039;,&#039;GOOG&#039;,&#039;MSFT&#039;)&amp;quot;)&lt;br /&gt;
 callback=&amp;quot;requestComplete&amp;quot;&lt;br /&gt;
 URL = &amp;quot;http://query.yahooapis.com/v1/public/yql?q=&amp;quot; &amp;amp; YQI &amp;amp; _&lt;br /&gt;
       &amp;quot;&amp;amp;format=json&amp;amp;env=http://datatables.org/alltables.env&amp;amp;callback=&amp;quot; &amp;amp; callback&lt;br /&gt;
 loadScript(URL)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Yahoo! has a very powerful API to look up all kinds of data. To make it easier, they have set up an interface using SQL like statements called YQI. In our code above, we start by creating our YQI request. The [[encodeURIComponent]]() function translates special characters and spaces so they can be sent in our Ajax call.&lt;br /&gt;
&lt;br /&gt;
URL is then composed of our YQI request with the rest of the boilerplate that is needed. The most interesting part is the &amp;amp;callback part. It names the function that the return values will be wrapped in.&lt;br /&gt;
&lt;br /&gt;
Having prepared everything, we can inject the script.&lt;br /&gt;
&lt;br /&gt;
==== Inject the script ====&lt;br /&gt;
&lt;br /&gt;
Yahoo! is going to return some code: it will be a call to the function we specified in callback, with the parameters all filled in. The following code will insert the code returned by Yahoo! into our program and execute it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function loadScript(JSONP)&lt;br /&gt;
  Dim head, script&lt;br /&gt;
  head=document.getElementsByTagName(&amp;quot;head&amp;quot;)[0]&lt;br /&gt;
  script=document.createElement(&amp;quot;script&amp;quot;)&lt;br /&gt;
  script.src= JSONP&lt;br /&gt;
  script.async=True&lt;br /&gt;
  head.appendChild(script)&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We do the usual checking to see if the call is complete. If it is, we will have gotten a text string back that looks something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
requestComplete({&amp;quot;query&amp;quot;:&lt;br /&gt;
  {&amp;quot;count&amp;quot;:3,&amp;quot;created&amp;quot;:&amp;quot;2012-03-20T11:34:00Z&amp;quot;,&amp;quot;lang&amp;quot;:&amp;quot;en-US&amp;quot;,&amp;quot;results&amp;quot;:&lt;br /&gt;
     {&amp;quot;quote&amp;quot;:...);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a valid function call, so when it is run, the function is executed.&lt;br /&gt;
&lt;br /&gt;
==== Execute the function ====&lt;br /&gt;
&lt;br /&gt;
The Eval() function causes requestComplete() to be called.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function requestComplete(data)&lt;br /&gt;
  Dim quotes, i&lt;br /&gt;
  quotes=data.query.results.quote&lt;br /&gt;
  TextArea1.value=&amp;quot;&amp;quot;&lt;br /&gt;
  For i=0 To Len(quotes)-1&lt;br /&gt;
    TextArea1.value=TextArea1.value+quotes[i].symbol &amp;amp; quotes[i].Ask &amp;amp; vbCRLF&lt;br /&gt;
  Next&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The data that comes back is a fairly complex structure with a lot of data in it. You can copy it to the NotePad to see everything that is there. For now, we are just interested in the asking price of the stock. The results are returned in an array, with one element per stock.&lt;br /&gt;
&lt;br /&gt;
=== Cool things you can get on the web ===&lt;br /&gt;
&lt;br /&gt;
There are many web services that work in a similar fashion. One of the tip offs is if the calling string has an &amp;amp;callback argument. If it does, it probably can be used with this method.&lt;br /&gt;
&lt;br /&gt;
Some of these services are free or limited, while others require an API key that you must obtain from the service.&lt;br /&gt;
&lt;br /&gt;
Some places to go for services:&lt;br /&gt;
&lt;br /&gt;
* The master list is here: [http://www.programmableweb.com Programmable Web]&lt;br /&gt;
* Lots of stuff: [http://developer.yahoo.com/javascript/ Yahoo]!&lt;br /&gt;
* Weather: [http://www.wunderground.com/weather/api/d/docs Wunderground]&lt;br /&gt;
* Elevation: [http://www.geonames.org/export/JSON-webservices.html Geonames]&lt;br /&gt;
* Geographic Info: [http://www.geonames.org/export/JSON-webservices.html Geonames]&lt;br /&gt;
&lt;br /&gt;
Got more? Let us know at support@nsbasic.com.&lt;br /&gt;
&lt;br /&gt;
=== Zip Code Lookup ===&lt;br /&gt;
&lt;br /&gt;
Ever realize, when getting a user&#039;s address, that knowing the zip code makes asking for the city and state unnecessary? Here&#039;s some simple code to look up the city and state from a zip code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zip=&amp;quot;90210&amp;quot;&lt;br /&gt;
&lt;br /&gt;
req=Ajax(&amp;quot;http://zip.elevenbasetwo.com?zip=&amp;quot; &amp;amp; zip)&lt;br /&gt;
If req.status=200 Then &#039;success&lt;br /&gt;
    MsgBox req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    MsgBox &amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
End If&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The result is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&amp;quot;country&amp;quot;: &amp;quot;US&amp;quot;, &amp;quot;state&amp;quot;: &amp;quot;CA&amp;quot;, &amp;quot;city&amp;quot;: &amp;quot;BEVERLY HILLS&amp;quot;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Cross Origin Resource Sharing ===&lt;br /&gt;
&lt;br /&gt;
A lot of the discussion in this Tech Note has been ways to get around Same Origin Policies. Can we get rid of this restriction? We can, but there&#039;s a catch.&lt;br /&gt;
To allow a PHP script on your server to give its results to apps which were not loaded from your server, add this line as the first line of your script.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
header(&#039;Access-Control-Allow-Origin: *&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The catch is that now anyone with an internet connection can run your PHP script.&lt;br /&gt;
&lt;br /&gt;
=== Using AJAX to send an email ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Contributed by Graham Barlow, New Zealand&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The AppStudio Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  EmailText = EmailText &amp;amp; vbCRLF &amp;amp; &amp;quot;Date: &amp;quot; &amp;amp; FormatDateTime(Date,&amp;quot;dd/mm/yy&amp;quot;)&lt;br /&gt;
  Url = &amp;quot;/ajaxEmailRegister.php/?EmailTo=gotnomates@farmmates.com&amp;quot;&lt;br /&gt;
  req=Ajax(Url,&amp;quot;POST&amp;quot;,EmailText)&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    MsgBox(&amp;quot;Confirmation email sent.&amp;quot;)&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    MsgBox(&amp;quot;Error sending email &amp;quot; &amp;amp; req.err)&lt;br /&gt;
  End If&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and the PHP script that gets called (&amp;quot;ajaxEmailRegister.php&amp;quot;):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  // Get the data from the client.&lt;br /&gt;
  $myText = file_get_contents(&#039;php://input&#039;);&lt;br /&gt;
  $to = $_GET[&#039;EmailTo&#039;];&lt;br /&gt;
  $subject = &amp;quot;New Mate registration confirmation&amp;quot;;&lt;br /&gt;
  $body = $myText;&lt;br /&gt;
  $headers = &amp;quot;From: gotnomates@farmmates.com&amp;quot;;&lt;br /&gt;
  mail($to, $subject, $body, $headers);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using AJAX to get info from a database on your server. ===&lt;br /&gt;
&lt;br /&gt;
Since AppStudio runs on your device, it cannot directly access files or databases on another computer, such as a server. It need to communicate with an app running on the server, which gets the information from the database and returns it.&lt;br /&gt;
&lt;br /&gt;
PHP has built in support for MySQL, Oracle and SQLite. If you have a database on your server, it&#039;s easy to query it and return the result to your app. Here&#039;s a very simple example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
$host = &amp;quot;localhost&amp;quot;;&lt;br /&gt;
$databasename = &amp;quot;myDatabaseName&amp;quot;;&lt;br /&gt;
$username =&amp;quot;myUsername&amp;quot;;&lt;br /&gt;
$password = &amp;quot;myPassword&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
$con = mysql_connect($host,$username,$password) or die(mysql_error());&lt;br /&gt;
mysql_select_db($databasename) or die(mysql_error());&lt;br /&gt;
$query = file_get_contents(&amp;quot;php://input&amp;quot;); &lt;br /&gt;
$results = mysql_query($query);&lt;br /&gt;
&lt;br /&gt;
if (mysql_errno()) { &lt;br /&gt;
  header(&amp;quot;HTTP/1.1 500 Internal Server Error&amp;quot;);&lt;br /&gt;
  echo $query.&#039;\n&#039;;&lt;br /&gt;
  echo mysql_error(); &lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
  $rows = array();&lt;br /&gt;
  while($r = mysql_fetch_assoc($results)) {&lt;br /&gt;
    $rows[] = $r;&lt;br /&gt;
  }&lt;br /&gt;
  echo json_encode($rows);&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is a link to an article showing how to do the same thing to Access:&lt;br /&gt;
&lt;br /&gt;
http://phpmaster.com/using-an-access-database-with-php/&lt;br /&gt;
&lt;br /&gt;
and Oracle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;http://www.php.net/manual/en/book.oci8.php&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You&#039;ll want to address security with this. There is no parsing of the incoming query string, so someone could conceivably put some malicious code in there (&amp;quot;[http://en.wikipedia.org/wiki/SQL_injection SQL Injection]&amp;quot;) and you may want to determine that the person requesting the info is authorized to do so.&lt;br /&gt;
&lt;br /&gt;
For a more detailed description, see this article: http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s XKCD&#039;s comment on this:&lt;br /&gt;
&lt;br /&gt;
[[File:Exploits of a mom.png]]&lt;br /&gt;
&lt;br /&gt;
=== Using AJAX to get save a picture to your server ===&lt;br /&gt;
&lt;br /&gt;
See the sample &amp;quot;CameraToServer&amp;quot;, contributed by Mike Miller jdmdude2009@gmail.com&lt;br /&gt;
&lt;br /&gt;
This sample lets you get a picture from the camera or the Photo Library&lt;br /&gt;
and display it on your screen and:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Push it to a web server in base64 or PNG format using an AJAX POST&lt;br /&gt;
&amp;lt;li&amp;gt;Receive a response from the server and do something with it.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
This is a mod of the original Camera Sample file.&lt;br /&gt;
You must have the supplied PHP files in the same location&lt;br /&gt;
as the AppStudio production files.&lt;br /&gt;
&lt;br /&gt;
To control when a pic may be sent or that a pic is not sent&lt;br /&gt;
multiple times by click happy users, btnSubmitImages is placed&lt;br /&gt;
in different states of visiblility and/or usability by way of the &lt;br /&gt;
SentFlag.&lt;br /&gt;
&lt;br /&gt;
Note: PictureBox1 is in the negative left of the form.&lt;br /&gt;
This is a trick that developers use to hide controls&lt;br /&gt;
from the users but still have availability to them.&lt;br /&gt;
&lt;br /&gt;
Image1 is used for preview ONLY because viewing PictureBox1&lt;br /&gt;
isn&#039;t very realistic for viewing because it exceeds the &lt;br /&gt;
mobile screen size. (You can size the PictureBox to any size&lt;br /&gt;
a camera is capable of, but beware, size does matter! The lag&lt;br /&gt;
to insert an image into a db gets longer as the pics get larger.&lt;br /&gt;
I also noticed phpmyadmin is not very responsive to large images AND&lt;br /&gt;
I have had timeouts when loading pages with lots of images. I suspect&lt;br /&gt;
some sort of slide presentation tool that controls the load of&lt;br /&gt;
the images will be in order to view large quantities of photos&lt;br /&gt;
(lot&#039;s of opensource for slide views)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; &amp;gt;&lt;br /&gt;
(the source code of the program)&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dim e&lt;br /&gt;
Dim SentFlag&lt;br /&gt;
&lt;br /&gt;
reader = new FileReader()&lt;br /&gt;
img=new Image()&lt;br /&gt;
SentFlag=0&lt;br /&gt;
&lt;br /&gt;
Sub Main()&lt;br /&gt;
  pb=PictureBox1.getContext(&amp;quot;2d&amp;quot;)&lt;br /&gt;
  SetTimeout(window.scrollTo(0,window.innerHeight),100)&lt;br /&gt;
  btnSubmitImage.value=&amp;quot;&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Function txtGetPicture_onchange()&lt;br /&gt;
  &#039;This gets called after the picture is chosen. &lt;br /&gt;
  &#039;Next, let&#039;s read start reading it in.&lt;br /&gt;
  &#039;The _onload function will be called when that completes.&lt;br /&gt;
  reader.readAsDataURL(txtGetPicture.files[0])&lt;br /&gt;
  e=event&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function reader_onload(e)&lt;br /&gt;
  &#039;read of the file is complete.&lt;br /&gt;
  &#039;Now, let&#039;s load it into an image.&lt;br /&gt;
  &#039;The _onload function for the image will be called on completion.&lt;br /&gt;
  img.src=e.target.result&lt;br /&gt;
  Image1.firstChild.src=e.target.result &#039;Phone Viewing ONLY&lt;br /&gt;
  SentFlag=0&lt;br /&gt;
  btnSubmitImage.hidden=False&lt;br /&gt;
  btnSubmitImage.value=&amp;quot;Send Image to Web&amp;quot;&lt;br /&gt;
  lblPicMsg.textContent=&amp;quot;Now is the time&amp;quot;&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function img_onload()&lt;br /&gt;
  &#039;image is now loaded. Let&#039;s add it to the PictureBox2 and scale&lt;br /&gt;
 &lt;br /&gt;
  &#039;PictureBox1 is very large here and takes a while for the image&lt;br /&gt;
  &#039;to transfer to the web server (approx 1MB)&lt;br /&gt;
  &#039;still no solution it the iOS distortion.&lt;br /&gt;
  pb.drawImage(img,0,0,PictureBox1.width,PictureBox1.Height)&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function PostToWebServer()&lt;br /&gt;
  Dim devInfo&lt;br /&gt;
  Dim postData&lt;br /&gt;
  &lt;br /&gt;
  SentFlag=1 &#039;Don&#039;t allow multiple submissions because the button&lt;br /&gt;
             &#039;is pushed more than once.&lt;br /&gt;
  &lt;br /&gt;
  &#039;Get divice information - not available &lt;br /&gt;
  devInfo=&amp;quot;No device selected&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  &#039;Build POST  &lt;br /&gt;
  postData = &amp;quot;filename=&amp;quot; &amp;amp; txtGetPicture.files[0].name&lt;br /&gt;
  postData = postData &amp;amp; &amp;quot;&amp;amp;deviceInfo=&amp;quot; &amp;amp; devInfo &lt;br /&gt;
  postData = postData &amp;amp; &amp;quot;&amp;amp;imgBase64=&amp;quot; &amp;amp; PictureBox1.toDataURL()&lt;br /&gt;
  &lt;br /&gt;
  &#039;Send POST to server&lt;br /&gt;
  req=Ajax(&amp;quot;insertimage.php&amp;quot;,&amp;quot;POST&amp;quot;,postData) &lt;br /&gt;
&lt;br /&gt;
  If req.status=200 Then &#039;success&lt;br /&gt;
    btnSubmitImage.hidden=True &#039;Picture was pushed to server so hide button&lt;br /&gt;
    lblPicMsg.textContent =  &amp;quot;Success!!!&amp;quot;&lt;br /&gt;
    htmResponse.innerHTML=req.responseText&lt;br /&gt;
  Else &#039;failure&lt;br /&gt;
    htmResponse.innerHTML=&amp;quot;Error: &amp;quot; &amp;amp; req.err&lt;br /&gt;
    btnSubmitImage.hidden=False&lt;br /&gt;
    lblPicMsg.textContent =  &amp;quot;Failure&amp;quot;&lt;br /&gt;
    SentFlag=0&lt;br /&gt;
  End If&lt;br /&gt;
&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Function btnSubmitImage_onclick()&lt;br /&gt;
  If Len(PictureBox1.toDataURL())&amp;gt;0 And SentFlag=0 Then&lt;br /&gt;
      btnSubmitImage.value = &amp;quot;Sending&amp;quot;&lt;br /&gt;
      lblPicMsg.textContent = &amp;quot;Please Wait&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
    &#039;Use the SetTimout function to call a procedure OUTSIDE&lt;br /&gt;
    &#039;this onclick event so that any events that need to &lt;br /&gt;
    &#039;occur on submission are not held up by the size of the&lt;br /&gt;
    &#039;image or the speed of the internet connection.&lt;br /&gt;
    &#039;(i.e. the btn value change and the label caption change.  &lt;br /&gt;
    SetTimeout(PostToWebServer,3000) &#039;POST TO WEB&lt;br /&gt;
    &lt;br /&gt;
  Else&lt;br /&gt;
      lblPicMsg.textContent =  &amp;quot;Need to take a pic first&amp;quot;&lt;br /&gt;
  End If&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using AJAX to get all kinds of stuff on the web ===&lt;br /&gt;
&lt;br /&gt;
Many websites have information that can be retrieved using AJAX. The best list we have found is on [http://www.programmableweb.com Programmable Web].&lt;br /&gt;
&lt;br /&gt;
=== Using Ajax with PhoneGap ===&lt;br /&gt;
&lt;br /&gt;
When running as a PhoneGap app, your program is no longer tied to the server it was downloaded from. As a result, it doesn&#039;t know where to go on the web. You need to make two changes to any of the above samples to make them work as PhoneGap apps.&lt;br /&gt;
&lt;br /&gt;
1. Declare the website you want to access in the PhoneGap configxml property (in Project Properties), by adding this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;access origin=&amp;quot;https://www.nsbasic.com&amp;quot; subdomains=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(substitute the URL to your site which has the script on it).&lt;br /&gt;
&lt;br /&gt;
2. Use the full path to the script in your Ajax call:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  req=Ajax(&amp;quot;https://www.nsbasic.com/i/Ajax/ajax.php/?myText=&amp;quot; + encodeURIComponent(txtSend.value))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Again, substitute the path to your script - don&#039;t use this one!)&lt;br /&gt;
&lt;br /&gt;
=== Using Ajax with ASP.NET ===&lt;br /&gt;
&lt;br /&gt;
Everything is pretty much the same on the AppStudio side. Here&#039;s how it looks on the server side. (Thanks to John Cody!)&lt;br /&gt;
&lt;br /&gt;
1) Make sure this entry is in your asp.net webservice&#039;s web.config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;webServices&amp;gt;&lt;br /&gt;
      &amp;lt;protocols&amp;gt;&lt;br /&gt;
        &amp;lt;add name=&amp;quot;HttpPost&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/protocols&amp;gt;&lt;br /&gt;
    &amp;lt;/webServices&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) ASP.NET VB code (i.e Service.asmx file):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Imports System.Web.Services&lt;br /&gt;
 Imports System.Web.Services.Protocols&lt;br /&gt;
 Imports System.ComponentModel&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;System.Web.Services.WebService(Namespace:=&amp;quot;http://tempuri.org/&amp;quot;)&amp;gt; _&lt;br /&gt;
 &amp;lt;System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&amp;gt; &amp;lt;ToolboxItem(False)&amp;gt; _&lt;br /&gt;
 Public Class WebService&lt;br /&gt;
     Inherits System.Web.Services.WebService&lt;br /&gt;
     &amp;lt;WebMethod()&amp;gt; _&lt;br /&gt;
     Public Function HelloWorld(Token as string) As String&lt;br /&gt;
         &#039;the var Token has the string that was send from the AppStudio app&lt;br /&gt;
         Return &amp;quot;Hello World&amp;quot;&lt;br /&gt;
     End Function&lt;br /&gt;
 End Class&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) AppStudio code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Dim req&lt;br /&gt;
&lt;br /&gt;
 Function cmdSend_onclick()&lt;br /&gt;
    req = Ajax(&amp;quot;http://mywebsite.com/Service.asmx/HelloWorld&amp;quot;,&amp;quot;POST&amp;quot;,&amp;quot;token=&amp;amp;Test123&amp;quot;, send_return)&lt;br /&gt;
 End Function&lt;br /&gt;
&lt;br /&gt;
 Function send_return()&lt;br /&gt;
    Dim Res&lt;br /&gt;
    If req.readyState &amp;lt;&amp;gt; 4 Then Exit Function &#039;ignore progress reports&lt;br /&gt;
    If req.status = 200 Then &#039;succes&lt;br /&gt;
       Res = req.responseTex&lt;br /&gt;
       &#039;Res has &amp;quot;Hello World&amp;quot; in it, but it is in XML/UTF-8 format and needs to be decoded&lt;br /&gt;
    Else&lt;br /&gt;
       &#039;some error&lt;br /&gt;
       End If&lt;br /&gt;
 End Function&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=ReadFile&amp;diff=6155</id>
		<title>ReadFile</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=ReadFile&amp;diff=6155"/>
		<updated>2014-07-14T19:40:56Z</updated>

		<summary type="html">&lt;p&gt;James: Cleaning up links and inaccuracies.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ReadFile (&#039;&#039;filename&#039;&#039;[,&#039;&#039;method&#039;&#039;])&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Note: This function can be replaced by the [[Ajax]]() function.&lt;br /&gt;
&lt;br /&gt;
ReadFile will read &#039;&#039;filename&#039;&#039; which can either be deployed with the app or be on the same server as the app. If the file is to be deployed with the app, include it in the manifest. This function will only work when deployed to a website: it will not work when running in the local browser. &lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;method&#039;&#039; to define the access method. Usually this parameter can be left out: the default is Get. The next most common value for this is Post. Post responses are never cached, whereas Get responses can be. Post also allows larger data transfers. Other methods are Connect, Delete, Head, Options, Put, Trace, or Track. For more information on these options, look up XMLHttpRequest on the web. The function is based on XMLHttpRequest. See the ReadFile.nsx sample.&lt;br /&gt;
&lt;br /&gt;
It returns two values: .status = 0 or 200 if the file was read successfully and .responseText which has the entire contents of the file. If the file is not read successfully, a different status code is returned in .status.&lt;br /&gt;
&lt;br /&gt;
There is no equivilent WriteFile. Use [[Sql]], [[LocalStorage]] or the [[Using_the_PhoneGap_API|PhoneGap API]] to save data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Returning the latest file contents&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can also pass a file location to ReadFile using this approach&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dim usrFile, req&lt;br /&gt;
usrFile = &amp;quot;users/12345.xml?&amp;quot; &amp;amp; SysInfo(10)&lt;br /&gt;
req = ReadFile(usrFile)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;?&amp;quot; &amp;amp; SysInfo(10)&amp;lt;/code&amp;gt; at the end of the .xml ensures that the latest file on the server is returned. This is useful where you perhaps update the file and want to return the latest version later on within your application. Excluding this will only return the last cached file contents that you read.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Rem ReadfileFile example&lt;br /&gt;
filename=&amp;quot;g.txt&amp;quot;&lt;br /&gt;
req=ReadFile(filename)&lt;br /&gt;
If req.status=200 Then&lt;br /&gt;
  MsgBox req.responseText&lt;br /&gt;
Else&lt;br /&gt;
  MsgBox &amp;quot;File could not be read&amp;quot;&lt;br /&gt;
End If&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Items ==&lt;br /&gt;
&lt;br /&gt;
* [[Ajax]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language Reference]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=GetJSON&amp;diff=6154</id>
		<title>GetJSON</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=GetJSON&amp;diff=6154"/>
		<updated>2014-07-14T19:30:52Z</updated>

		<summary type="html">&lt;p&gt;James: /* Related Items */ Added encodeURIComponent and fixed Ajax link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GetJSON(&#039;&#039;url&#039;&#039;,&#039;&#039;data&#039;&#039;,&#039;&#039;callback&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
GetJSON loads JSON-encoded data from the server using a GET HTTP request. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;url&#039;&#039; is the location that data is being requested from.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;data&#039;&#039; is the information about the request. If multiple fields are being passed, include them in a single string, separated by ampersand (&amp;amp;) characters. It&#039;s best to do an [[EncodeURIComponent/decodeURIComponent|encodeURIComponent]]() to the data to make sure that spaces and other special characters are properly formatted.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;callback&#039;&#039; is the name of the function in your program to be called when the request is complete. Since the request may take a little while to complete, your app will continue execution immediately after the GetJSON() function is called. The results will not be available until the &#039;&#039;callback&#039;&#039; function is called. The returned data is passed to the &#039;&#039;callback&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
If you are using this with PhoneGap, remember to [http://docs.phonegap.com/en/3.4.0/guide_appdev_whitelist_index.md.html#Whitelist%20Guide add the remote site to your whitelist]. Do this by adding lines to your PhoneGap configxml project property.&lt;br /&gt;
&lt;br /&gt;
For uploading data, GetJSON has a limit imposed by a server setting: it is usually 8192 bytes. There is no response size limit. If you need to send more information, use the [[Ajax]]() function.&lt;br /&gt;
&lt;br /&gt;
This function is a wrapper for the jQuery [http://api.jquery.com/jQuery.getJSON/ $.getJSON()] function. It works identically.&lt;br /&gt;
&lt;br /&gt;
=== Server side ===&lt;br /&gt;
&lt;br /&gt;
GetJSON a much easier and more compatible way of calling a cross domain web server.  GetJSON supports this out of the&lt;br /&gt;
box.  You will have to:&lt;br /&gt;
&lt;br /&gt;
# Append ?callback=? to your URL.&lt;br /&gt;
# Change your MIME type to application/javascript&lt;br /&gt;
# Read in the callback parameter server side and respond with the JSON wrapped in the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    cbvalue(json);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
cbvalue is the value of callback, json is your JSON data.&lt;br /&gt;
&lt;br /&gt;
This will allow you to make cross domain requests without messing with headers or browser settings.&lt;br /&gt;
&lt;br /&gt;
=== Testing an API Function ===&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a trick you can use to test many of these API calls. Combine the URL and the parameters into a single string separated by a question mark (&amp;quot;?&amp;quot;):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://api.openweathermap.org/data/2.5/weather?q=Toronto&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Paste this into a browser and you will get:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&amp;quot;coord&amp;quot;:{&amp;quot;lon&amp;quot;:-79.39,&amp;quot;lat&amp;quot;:43.65},&amp;quot;sys&amp;quot;:&lt;br /&gt;
{&amp;quot;message&amp;quot;:0.0454,&amp;quot;country&amp;quot;:&amp;quot;Canada&amp;quot;,&amp;quot;sunrise&amp;quot;:1396263570,&lt;br /&gt;
&amp;quot;sunset&amp;quot;:1396309411},&amp;quot;weather&amp;quot;:[{&amp;quot;id&amp;quot;:801,&amp;quot;main&amp;quot;:&amp;quot;Clouds&amp;quot;,&lt;br /&gt;
&amp;quot;description&amp;quot;:&amp;quot;few clouds&amp;quot;,&amp;quot;icon&amp;quot;:&amp;quot;02n&amp;quot;}],&amp;quot;base&amp;quot;:&amp;quot;cmc stations&amp;quot;,&lt;br /&gt;
&amp;quot;main&amp;quot;:&amp;quot;temp&amp;quot;:273.2,&amp;quot;humidity&amp;quot;:54,&amp;quot;pressure&amp;quot;:1019,&lt;br /&gt;
&amp;quot;temp_min&amp;quot;:271.48,&amp;quot;temp_max&amp;quot;:275.15},&amp;quot;wind&amp;quot;:{&amp;quot;speed&amp;quot;:2.3,&lt;br /&gt;
&amp;quot;deg&amp;quot;:320.501},&amp;quot;rain&amp;quot;:{&amp;quot;3h&amp;quot;:0},&amp;quot;snow&amp;quot;:{&amp;quot;3h&amp;quot;:0},&amp;quot;clouds&amp;quot;:{&amp;quot;all&amp;quot;:12},&lt;br /&gt;
&amp;quot;dt&amp;quot;:1396259691,&amp;quot;id&amp;quot;:6167865,&amp;quot;name&amp;quot;:&amp;quot;Toronto&amp;quot;,&amp;quot;cod&amp;quot;:200}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Encoding the Parameters ===&lt;br /&gt;
&lt;br /&gt;
Certain characters, such as the space key, are not allowed in URL strings. The above example would fail on the city &amp;quot;New York&amp;quot; if it was not encoded. The [[EncodeURIComponent/decodeURIComponent|encodeURIComponent]]() function converts your parameters into a string which will work perfectly as a URL.&lt;br /&gt;
&lt;br /&gt;
== Example (BASIC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Function btnLoad_onclick()&lt;br /&gt;
  Dim city = &amp;quot;q=&amp;quot; &amp;amp; encodeURIComponent(txtCity.value)&lt;br /&gt;
  Dim URL = &amp;quot;http://api.openweathermap.org/data/2.5/weather&amp;quot;&lt;br /&gt;
  GetJSON(URL, city, weatherData)&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Sub weatherData(data)&lt;br /&gt;
  MsgBox &amp;quot;Temperature is &amp;quot; &amp;amp; data.main.temp - 273.15&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example (JavaScript) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function btnLoad_onclick() {&lt;br /&gt;
  var city = &amp;quot;q=&amp;quot; + encodeURIComponent(txtCity.value);&lt;br /&gt;
  var URL = &amp;quot;http://api.openweathermap.org/data/2.5/weather&amp;quot;;&lt;br /&gt;
  GetJSON(URL, city, weatherData);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function weatherData(data) {&lt;br /&gt;
  alert(&amp;quot;Temperature is &amp;quot; + data.main.temp - 273.15);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Items ==&lt;br /&gt;
&lt;br /&gt;
* [[Ajax]]&lt;br /&gt;
* [[encodeURIComponent]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language Reference]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Ajax&amp;diff=6153</id>
		<title>Ajax</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Ajax&amp;diff=6153"/>
		<updated>2014-07-14T19:28:55Z</updated>

		<summary type="html">&lt;p&gt;James: /* Example (BASIC) */ spacing issue&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ajax(&#039;&#039;URL&#039;&#039;[, &#039;&#039;method&#039;&#039;[, &#039;&#039;data&#039;&#039;[, &#039;&#039;returnFunction&#039;&#039;]]])&amp;lt;br&amp;gt;&lt;br /&gt;
Ajax(&#039;&#039;URL&#039;&#039;, &#039;&#039;settingsObject&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The Ajax function is used to get or receive data from a server. It is based on [[:wikipedia:XMLHttpRequest|XMLHttpRequest]]. This function will only work when running from a server (including the built in AppStudio local server) and is subject to the [[wikipedia:Same-origin_policy|same-origin policy]] in some cases. It is a wrapper for [https://api.jquery.com/jQuery.ajax/ jQuery&#039;s $.ajax() function].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;URL&#039;&#039; is the address on the server. It can be the name of a file to be downloaded from the server or a script to be run on the server. Optional information can be passed to the server at the end of the URL: for example &lt;br /&gt;
  http://www.nsbasic.com/getCustomerInfo.php?customer=Knuth &lt;br /&gt;
will call the PHP script named getCustomerInfo.php, passing the parameter customer=Knuth. Data passed in URLs must be encoded properly. This is done with [[encodeURIComponent]].&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;method&#039;&#039; to define the access method. If this parameter is omitted, GET is used. The most common value for this is POST. POST responses are never cached, whereas GET responses can be. POST also allows larger data transfers. If you are using POST, put the information you want to send in data. The normal size limit for data is 8 megabytes: it is a server setting which can be increased. This is an easy and efficient way to send data to a server. Other useful methods are DELETE and PUT. For more information on these options, see [[:wikipedia:XMLHttpRequest#The_open_method|XMLHttpRequest&#039;s open method]].  For more information on other methods see [[:wikipedia:Hypertext_Transfer_Protocol#Request_methods|HTTP request methods]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;returnFunction&#039;&#039;, if supplied, is a function to be called when the results return, allowing asynchronous execution. If this parameter is not supplied, execution will continue at the next statement after the results return. Do not put MsgBox statements inside your Ajax code: they mess up the event sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;settingsObject&#039;&#039; is an object containing all the settings, in the form {data: &amp;quot;some data&amp;quot;, type: &amp;quot;GET&amp;quot;, success: AjaxWorked}. For a complete list of possible settings, see the [https://api.jquery.com/jQuery.ajax/ $.ajax docs].&lt;br /&gt;
&lt;br /&gt;
It returns the following values:&lt;br /&gt;
&lt;br /&gt;
.status:  The status of the response to the request. This is the [http://en.wikipedia.org/wiki/List_of_HTTP_status_codes HTTP result code] (for example, status is 200 for a successful request). 404 means page not found.&lt;br /&gt;
&lt;br /&gt;
.statusText: The response string returned by the HTTP server. Unlike status, this includes the entire text of the response message (&amp;quot;200 OK&amp;quot;, for example).&lt;br /&gt;
&lt;br /&gt;
.responseText: The response to the request as text, or null if the request was unsuccessful or has not yet been sent.&lt;br /&gt;
&lt;br /&gt;
.readyState: The state of the request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
State  Description&lt;br /&gt;
0      UNSENT:The request is not initialized&lt;br /&gt;
1      OPENED: The request has been set up&lt;br /&gt;
2      HEADERS_RECEIVED send() has been called, and headers and status are available.&lt;br /&gt;
3      LOADING: Downloading; responseText holds partial data.&lt;br /&gt;
4      DONE: The request is complete&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also samples Ajax and AjaxPost for more information.&lt;br /&gt;
&lt;br /&gt;
== Example (BASIC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&#039;Ajax example&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajax.php?myText=&amp;quot; &amp;amp; encodeURIComponent(txtSend.value))&lt;br /&gt;
If req.status = 200 Then &#039;success&lt;br /&gt;
    txtResponse.value = req.responseText&lt;br /&gt;
Else &#039;failure&lt;br /&gt;
    txtResponse.value = &amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
&#039;Sample POST call&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajaxPost.php&amp;quot;, &amp;quot;POST&amp;quot;, &amp;quot;myText=&amp;quot; &amp;amp; encodeURIComponent(txtSend.value))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example (JavaScript) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
//Ajax example&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajax.php?myText=&amp;quot; + encodeURIComponent(txtSend.value));&lt;br /&gt;
if(req.status == 200) { //success&lt;br /&gt;
    txtResponse.value = req.responseText;&lt;br /&gt;
  } else { //failure&lt;br /&gt;
    txtResponse.value = &amp;quot;Error: &amp;quot;  +  req.err.message;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 //Sample POST call&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajaxPost.php&amp;quot; , &amp;quot;POST&amp;quot; , &amp;quot;myText=&amp;quot;  +  encodeURIComponent(txtSend.value));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Items ==&lt;br /&gt;
&lt;br /&gt;
* [[ReadFile]]&lt;br /&gt;
&lt;br /&gt;
* [[Ajax made Simple]]&lt;br /&gt;
&lt;br /&gt;
* [[encodeURIComponent]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language Reference]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Ajax&amp;diff=6151</id>
		<title>Ajax</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Ajax&amp;diff=6151"/>
		<updated>2014-07-14T19:19:23Z</updated>

		<summary type="html">&lt;p&gt;James: Added references to encodeURIComponent.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ajax(&#039;&#039;URL&#039;&#039;[, &#039;&#039;method&#039;&#039;[, &#039;&#039;data&#039;&#039;[, &#039;&#039;returnFunction&#039;&#039;]]])&amp;lt;br&amp;gt;&lt;br /&gt;
Ajax(&#039;&#039;URL&#039;&#039;, &#039;&#039;settingsObject&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The Ajax function is used to get or receive data from a server. It is based on [[:wikipedia:XMLHttpRequest|XMLHttpRequest]]. This function will only work when running from a server (including the built in AppStudio local server) and is subject to the [[wikipedia:Same-origin_policy|same-origin policy]] in some cases. It is a wrapper for [https://api.jquery.com/jQuery.ajax/ jQuery&#039;s $.ajax() function].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;URL&#039;&#039; is the address on the server. It can be the name of a file to be downloaded from the server or a script to be run on the server. Optional information can be passed to the server at the end of the URL: for example &lt;br /&gt;
  http://www.nsbasic.com/getCustomerInfo.php?customer=Knuth &lt;br /&gt;
will call the PHP script named getCustomerInfo.php, passing the parameter customer=Knuth. Data passed in URLs must be encoded properly. This is done with [[encodeURIComponent]].&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;method&#039;&#039; to define the access method. If this parameter is omitted, GET is used. The most common value for this is POST. POST responses are never cached, whereas GET responses can be. POST also allows larger data transfers. If you are using POST, put the information you want to send in data. The normal size limit for data is 8 megabytes: it is a server setting which can be increased. This is an easy and efficient way to send data to a server. Other useful methods are DELETE and PUT. For more information on these options, see [[:wikipedia:XMLHttpRequest#The_open_method|XMLHttpRequest&#039;s open method]].  For more information on other methods see [[:wikipedia:Hypertext_Transfer_Protocol#Request_methods|HTTP request methods]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;returnFunction&#039;&#039;, if supplied, is a function to be called when the results return, allowing asynchronous execution. If this parameter is not supplied, execution will continue at the next statement after the results return. Do not put MsgBox statements inside your Ajax code: they mess up the event sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;settingsObject&#039;&#039; is an object containing all the settings, in the form {data: &amp;quot;some data&amp;quot;, type: &amp;quot;GET&amp;quot;, success: AjaxWorked}. For a complete list of possible settings, see the [https://api.jquery.com/jQuery.ajax/ $.ajax docs].&lt;br /&gt;
&lt;br /&gt;
It returns the following values:&lt;br /&gt;
&lt;br /&gt;
.status:  The status of the response to the request. This is the [http://en.wikipedia.org/wiki/List_of_HTTP_status_codes HTTP result code] (for example, status is 200 for a successful request). 404 means page not found.&lt;br /&gt;
&lt;br /&gt;
.statusText: The response string returned by the HTTP server. Unlike status, this includes the entire text of the response message (&amp;quot;200 OK&amp;quot;, for example).&lt;br /&gt;
&lt;br /&gt;
.responseText: The response to the request as text, or null if the request was unsuccessful or has not yet been sent.&lt;br /&gt;
&lt;br /&gt;
.readyState: The state of the request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
State  Description&lt;br /&gt;
0      UNSENT:The request is not initialized&lt;br /&gt;
1      OPENED: The request has been set up&lt;br /&gt;
2      HEADERS_RECEIVED send() has been called, and headers and status are available.&lt;br /&gt;
3      LOADING: Downloading; responseText holds partial data.&lt;br /&gt;
4      DONE: The request is complete&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also samples Ajax and AjaxPost for more information.&lt;br /&gt;
&lt;br /&gt;
== Example (BASIC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&#039;Ajax example&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajax.php?myText=&amp;quot; &amp;amp; encodeURIComponent (txtSend.value))&lt;br /&gt;
If req.status = 200 Then &#039;success&lt;br /&gt;
    txtResponse.value = req.responseText&lt;br /&gt;
Else &#039;failure&lt;br /&gt;
    txtResponse.value = &amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
&#039;Sample POST call&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajaxPost.php&amp;quot;, &amp;quot;POST&amp;quot;, &amp;quot;myText=&amp;quot; &amp;amp; encodeURIComponent(txtSend.value))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example (JavaScript) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
//Ajax example&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajax.php?myText=&amp;quot; + encodeURIComponent(txtSend.value));&lt;br /&gt;
if(req.status == 200) { //success&lt;br /&gt;
    txtResponse.value = req.responseText;&lt;br /&gt;
  } else { //failure&lt;br /&gt;
    txtResponse.value = &amp;quot;Error: &amp;quot;  +  req.err.message;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 //Sample POST call&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajaxPost.php&amp;quot; , &amp;quot;POST&amp;quot; , &amp;quot;myText=&amp;quot;  +  encodeURIComponent(txtSend.value));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Items ==&lt;br /&gt;
&lt;br /&gt;
* [[ReadFile]]&lt;br /&gt;
&lt;br /&gt;
* [[Ajax made Simple]]&lt;br /&gt;
&lt;br /&gt;
* [[encodeURIComponent]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language Reference]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Ajax&amp;diff=6150</id>
		<title>Ajax</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Ajax&amp;diff=6150"/>
		<updated>2014-07-10T17:45:55Z</updated>

		<summary type="html">&lt;p&gt;James: Revised notes on where Ajax will work.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ajax(&#039;&#039;URL&#039;&#039;[, &#039;&#039;method&#039;&#039;[, &#039;&#039;data&#039;&#039;[, &#039;&#039;returnFunction&#039;&#039;]]])&amp;lt;br&amp;gt;&lt;br /&gt;
Ajax(&#039;&#039;URL&#039;&#039;, &#039;&#039;settingsObject&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The Ajax function is used to get or receive data from a server. It is based on [[:wikipedia:XMLHttpRequest|XMLHttpRequest]]. This function will only work when running from a server (including the built in AppStudio local server) and is subject to the [[wikipedia:Same-origin_policy|same-origin policy]] in some cases. It is a wrapper for [https://api.jquery.com/jQuery.ajax/ jQuery&#039;s $.ajax() function].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;URL&#039;&#039; is the address on the server. It can be the name of a file to be downloaded from the server or a script to be run on the server. Optional information can be passed to the server at the end of the URL: for example &lt;br /&gt;
  http://www.nsbasic.com/getCustomerInfo.php?customer=Knuth &lt;br /&gt;
will call the PHP script named getCustomerInfo.php, passing the parameter customer=Knuth.&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;method&#039;&#039; to define the access method. If this parameter is omitted, GET is used. The most common value for this is POST. POST responses are never cached, whereas GET responses can be. POST also allows larger data transfers. If you are using POST, put the information you want to send in data. The normal size limit for data is 8 megabytes: it is a server setting which can be increased. This is an easy and efficient way to send data to a server. Other useful methods are DELETE and PUT. For more information on these options, see [[:wikipedia:XMLHttpRequest#The_open_method|XMLHttpRequest&#039;s open method]].  For more information on other methods see [[:wikipedia:Hypertext_Transfer_Protocol#Request_methods|HTTP request methods]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;returnFunction&#039;&#039;, if supplied, is a function to be called when the results return, allowing asynchronous execution. If this parameter is not supplied, execution will continue at the next statement after the results return. Do not put MsgBox statements inside your Ajax code: they mess up the event sequence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;settingsObject&#039;&#039; is an object containing all the settings, in the form {data: &amp;quot;some data&amp;quot;, type: &amp;quot;GET&amp;quot;, success: AjaxWorked}. For a complete list of possible settings, see the [https://api.jquery.com/jQuery.ajax/ $.ajax docs].&lt;br /&gt;
&lt;br /&gt;
It returns the following values:&lt;br /&gt;
&lt;br /&gt;
.status:  The status of the response to the request. This is the [http://en.wikipedia.org/wiki/List_of_HTTP_status_codes HTTP result code] (for example, status is 200 for a successful request). 404 means page not found.&lt;br /&gt;
&lt;br /&gt;
.statusText: The response string returned by the HTTP server. Unlike status, this includes the entire text of the response message (&amp;quot;200 OK&amp;quot;, for example).&lt;br /&gt;
&lt;br /&gt;
.responseText: The response to the request as text, or null if the request was unsuccessful or has not yet been sent.&lt;br /&gt;
&lt;br /&gt;
.readyState: The state of the request:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
State  Description&lt;br /&gt;
0      UNSENT:The request is not initialized&lt;br /&gt;
1      OPENED: The request has been set up&lt;br /&gt;
2      HEADERS_RECEIVED send() has been called, and headers and status are available.&lt;br /&gt;
3      LOADING: Downloading; responseText holds partial data.&lt;br /&gt;
4      DONE: The request is complete&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also samples Ajax and AjaxPost for more information.&lt;br /&gt;
&lt;br /&gt;
== Example (BASIC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&#039;Ajax example&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajax.php/?myText=&amp;quot; + txtSend.value) &lt;br /&gt;
If req.status = 200 Then &#039;success&lt;br /&gt;
    txtResponse.value = req.responseText&lt;br /&gt;
Else &#039;failure&lt;br /&gt;
    txtResponse.value = &amp;quot;Error: &amp;quot; &amp;amp; req.err.message&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
&#039;Sample POST call&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajaxPost.php&amp;quot;, &amp;quot;POST&amp;quot;, &amp;quot;myText=&amp;quot; &amp;amp; txtSend.value)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example (JavaScript) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
//Ajax example&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajax.php/?myText=&amp;quot; + txtSend.value);&lt;br /&gt;
if(req.status == 200) { //success&lt;br /&gt;
    txtResponse.value = req.responseText;&lt;br /&gt;
  } else { //failure&lt;br /&gt;
    txtResponse.value = &amp;quot;Error: &amp;quot;  +  req.err.message;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 //Sample POST call&lt;br /&gt;
req = Ajax(&amp;quot;/sendData_ajaxPost.php&amp;quot; , &amp;quot;POST&amp;quot; , &amp;quot;myText=&amp;quot;  +  txtSend.value);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Items ==&lt;br /&gt;
&lt;br /&gt;
* [[ReadFile]]&lt;br /&gt;
&lt;br /&gt;
* [[Ajax made Simple]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language Reference]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous]]&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5414</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5414"/>
		<updated>2014-02-09T07:27:44Z</updated>

		<summary type="html">&lt;p&gt;James: /* Determining the CPU Type */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.4-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.4 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.4-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/NSB_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.2.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;nsb&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;nsb&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default its remote location to your home folder on the server.  Upload the &amp;quot;nsb&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r nsb user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;nsb&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;nsb&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/nsb /srv/ftp/templates/3.2.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.2.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/NSB_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/NSB_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/NSB_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../NSB_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to NSB_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.  Also, if the template files already exist in the upload, they will not be replaced by a link.&lt;br /&gt;
&lt;br /&gt;
=== Verification with AppStudio ===&lt;br /&gt;
&lt;br /&gt;
You cannot verify the complete functionality of the server with AppStudio.  You can, however, test he FTP and HTTP components of the server by configuring AppStudio to upload to your server directly:&lt;br /&gt;
&lt;br /&gt;
* Go into AppStudio&#039;s Preferences:&lt;br /&gt;
** Windows: This will be in the Tools menu.&lt;br /&gt;
** Mac OS: This will be in the AppStudio menu.&lt;br /&gt;
* Change the Deployment Location to &amp;quot;Deploy to server listed below&amp;quot;.  You will only be able to perform this step if you have a registered copy.&lt;br /&gt;
* Set the server to the hostname or IP address of the server you&#039;ve just configured&lt;br /&gt;
* Set the username to the name of your ftp user.&lt;br /&gt;
* Set the password to the password of your ftp user.&lt;br /&gt;
* Click OK.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot_2014-02-03_20.17.14.png]]&lt;br /&gt;
&lt;br /&gt;
Now, when you deploy your application, you should be able to access it at: http://[servername]/[projectname]/&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5413</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5413"/>
		<updated>2014-02-09T07:26:57Z</updated>

		<summary type="html">&lt;p&gt;James: /* Create Bootable Media */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.4 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.4-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/NSB_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.2.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;nsb&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;nsb&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default its remote location to your home folder on the server.  Upload the &amp;quot;nsb&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r nsb user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;nsb&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;nsb&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/nsb /srv/ftp/templates/3.2.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.2.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/NSB_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/NSB_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/NSB_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../NSB_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to NSB_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.  Also, if the template files already exist in the upload, they will not be replaced by a link.&lt;br /&gt;
&lt;br /&gt;
=== Verification with AppStudio ===&lt;br /&gt;
&lt;br /&gt;
You cannot verify the complete functionality of the server with AppStudio.  You can, however, test he FTP and HTTP components of the server by configuring AppStudio to upload to your server directly:&lt;br /&gt;
&lt;br /&gt;
* Go into AppStudio&#039;s Preferences:&lt;br /&gt;
** Windows: This will be in the Tools menu.&lt;br /&gt;
** Mac OS: This will be in the AppStudio menu.&lt;br /&gt;
* Change the Deployment Location to &amp;quot;Deploy to server listed below&amp;quot;.  You will only be able to perform this step if you have a registered copy.&lt;br /&gt;
* Set the server to the hostname or IP address of the server you&#039;ve just configured&lt;br /&gt;
* Set the username to the name of your ftp user.&lt;br /&gt;
* Set the password to the password of your ftp user.&lt;br /&gt;
* Click OK.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot_2014-02-03_20.17.14.png]]&lt;br /&gt;
&lt;br /&gt;
Now, when you deploy your application, you should be able to access it at: http://[servername]/[projectname]/&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5341</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5341"/>
		<updated>2014-02-04T01:26:47Z</updated>

		<summary type="html">&lt;p&gt;James: /* Verification with AppStudio */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/NSB_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.2.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;nsb&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;nsb&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default its remote location to your home folder on the server.  Upload the &amp;quot;nsb&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r nsb user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;nsb&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;nsb&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/nsb /srv/ftp/templates/3.2.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.2.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/NSB_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/NSB_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/NSB_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../NSB_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to NSB_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.  Also, if the template files already exist in the upload, they will not be replaced by a link.&lt;br /&gt;
&lt;br /&gt;
=== Verification with AppStudio ===&lt;br /&gt;
&lt;br /&gt;
You cannot verify the complete functionality of the server with AppStudio.  You can, however, test he FTP and HTTP components of the server by configuring AppStudio to upload to your server directly:&lt;br /&gt;
&lt;br /&gt;
* Go into AppStudio&#039;s Preferences:&lt;br /&gt;
** Windows: This will be in the Tools menu.&lt;br /&gt;
** Mac OS: This will be in the AppStudio menu.&lt;br /&gt;
* Change the Deployment Location to &amp;quot;Deploy to server listed below&amp;quot;.  You will only be able to perform this step if you have a registered copy.&lt;br /&gt;
* Set the server to the hostname or IP address of the server you&#039;ve just configured&lt;br /&gt;
* Set the username to the name of your ftp user.&lt;br /&gt;
* Set the password to the password of your ftp user.&lt;br /&gt;
* Click OK.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot_2014-02-03_20.17.14.png]]&lt;br /&gt;
&lt;br /&gt;
Now, when you deploy your application, you should be able to access it at: http://[servername]/[projectname]/&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5340</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5340"/>
		<updated>2014-02-04T01:25:01Z</updated>

		<summary type="html">&lt;p&gt;James: /* Uploading &amp;amp; Verification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/NSB_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.2.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;nsb&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;nsb&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default its remote location to your home folder on the server.  Upload the &amp;quot;nsb&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r nsb user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;nsb&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;nsb&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/nsb /srv/ftp/templates/3.2.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.2.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/NSB_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/NSB_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/NSB_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../NSB_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to NSB_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.  Also, if the template files already exist in the upload, they will not be replaced by a link.&lt;br /&gt;
&lt;br /&gt;
=== Verification with AppStudio ===&lt;br /&gt;
&lt;br /&gt;
You cannot verify the complete functionality of the server with AppStudio.  You can, however, test he FTP and HTTP components of the server by configuring AppStudio to upload to your server directly:&lt;br /&gt;
&lt;br /&gt;
* Go into AppStudio&#039;s Preferences:&lt;br /&gt;
** Windows: This will be in the Tools menu.&lt;br /&gt;
** Mac OS: This will be in the AppStudio menu.&lt;br /&gt;
* Change the Deployment Location to &amp;quot;Deploy to server listed below&amp;quot;.  You will only be able to perform this step if you have a registered copy.&lt;br /&gt;
* Set the server to the hostname or IP address of the server you&#039;ve just configured&lt;br /&gt;
* Set the username to the name of your ftp user.&lt;br /&gt;
* Set the password to the password of your ftp user.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot_2014-02-03_20.17.14.png]]&lt;br /&gt;
&lt;br /&gt;
Now, when you deploy your application, you should be able to access it at: http://[servername]/[projectname]/&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot_2014-02-03_20.17.14.png&amp;diff=5339</id>
		<title>File:Screenshot 2014-02-03 20.17.14.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot_2014-02-03_20.17.14.png&amp;diff=5339"/>
		<updated>2014-02-04T01:18:59Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5323</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5323"/>
		<updated>2014-01-29T23:26:54Z</updated>

		<summary type="html">&lt;p&gt;James: /* Verification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/NSB_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.2.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;nsb&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;nsb&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default its remote location to your home folder on the server.  Upload the &amp;quot;nsb&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r nsb user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;nsb&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;nsb&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/nsb /srv/ftp/templates/3.2.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.2.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/NSB_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/NSB_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/NSB_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../NSB_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to NSB_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.  Also, if the template files already exist in the upload, they will not be replaced by a link.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5314</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5314"/>
		<updated>2014-01-28T08:54:33Z</updated>

		<summary type="html">&lt;p&gt;James: /* Configuring incron */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/NSB_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.2.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;nsb&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;nsb&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default its remote location to your home folder on the server.  Upload the &amp;quot;nsb&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r nsb user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;nsb&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;nsb&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/nsb /srv/ftp/templates/3.2.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.2.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/NSB_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/NSB_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/NSB_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../NSB_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to NSB_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5313</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5313"/>
		<updated>2014-01-28T08:54:17Z</updated>

		<summary type="html">&lt;p&gt;James: /* Copying &amp;quot;nsb&amp;quot; to the Template Folder */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/NSB_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.2.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;nsb&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;nsb&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default its remote location to your home folder on the server.  Upload the &amp;quot;nsb&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r nsb user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;nsb&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;nsb&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/nsb /srv/ftp/templates/3.2.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/NSB_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/NSB_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/NSB_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../NSB_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to NSB_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5312</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5312"/>
		<updated>2014-01-28T08:53:57Z</updated>

		<summary type="html">&lt;p&gt;James: /* Creating the proper folder structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/NSB_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/NSB_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.2.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;nsb&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;nsb&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default its remote location to your home folder on the server.  Upload the &amp;quot;nsb&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;nsb&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r nsb user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;nsb&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;nsb&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/nsb /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/NSB_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/NSB_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/NSB_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../NSB_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to NSB_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5301</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5301"/>
		<updated>2014-01-20T22:58:33Z</updated>

		<summary type="html">&lt;p&gt;James: /* Uploading &amp;amp; Verification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note, that if the uploaded project does not contain &amp;quot;index.html&amp;quot; or the included &amp;quot;index.html&amp;quot; file does not contain a proper generator string (e.g. &amp;lt;code&amp;gt;&amp;amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3&amp;lt;/code&amp;gt;...) the template files will not be linked.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5300</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5300"/>
		<updated>2014-01-20T22:55:56Z</updated>

		<summary type="html">&lt;p&gt;James: /* Configuring VSFTPD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.  If you need an FTP client, WinSCP (http://winscp.net/eng/index.php) is a popular choice for Windows and Cyberduck (http://cyberduck.io/) is a popular choice for Mac OS.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5299</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5299"/>
		<updated>2014-01-20T22:53:43Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/vsftpd.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O, verify the file name, and then exit with Ctrl-X.&lt;br /&gt;
&lt;br /&gt;
Mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O, verify the file name, and then exit with Ctrl-X:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot25.png&amp;diff=5298</id>
		<title>File:Screenshot25.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot25.png&amp;diff=5298"/>
		<updated>2014-01-20T22:49:12Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5297</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5297"/>
		<updated>2014-01-20T22:48:49Z</updated>

		<summary type="html">&lt;p&gt;James: /* Configuring VSFTPD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot25.png]]&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O and mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot24.png&amp;diff=5296</id>
		<title>File:Screenshot24.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot24.png&amp;diff=5296"/>
		<updated>2014-01-20T22:47:46Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5295</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5295"/>
		<updated>2014-01-20T22:47:14Z</updated>

		<summary type="html">&lt;p&gt;James: /* Configure Apache */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot24.png]]&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O and mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot23.png&amp;diff=5294</id>
		<title>File:Screenshot23.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot23.png&amp;diff=5294"/>
		<updated>2014-01-20T22:46:23Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5293</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5293"/>
		<updated>2014-01-20T22:45:43Z</updated>

		<summary type="html">&lt;p&gt;James: /* Update Packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot23.png]]&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O and mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot22.png&amp;diff=5292</id>
		<title>File:Screenshot22.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot22.png&amp;diff=5292"/>
		<updated>2014-01-20T22:42:07Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5291</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5291"/>
		<updated>2014-01-20T22:39:26Z</updated>

		<summary type="html">&lt;p&gt;James: /* Remote Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
Upon logging in, you should see the following:&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot22.png]]&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O and mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5290</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5290"/>
		<updated>2014-01-20T22:36:35Z</updated>

		<summary type="html">&lt;p&gt;James: /* Remote Access */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.  When you first connect you will be prompted to verify you want to connect to the host.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O and mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot21.png&amp;diff=5289</id>
		<title>File:Screenshot21.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot21.png&amp;diff=5289"/>
		<updated>2014-01-20T22:34:11Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5288</id>
		<title>Test Server Installation and Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Test_Server_Installation_and_Configuration&amp;diff=5288"/>
		<updated>2014-01-20T22:33:45Z</updated>

		<summary type="html">&lt;p&gt;James: /* Install Ubuntu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Front Matter ==&lt;br /&gt;
&lt;br /&gt;
The following instructions will walk you through installing and configuring an AppStudio Test Server.  They assume you have a basic understanding of how to use computers, but no prior knowledge otherwise.  You will be installing Ubuntu Server, which is a Linux distribution.  You should have physical access to the server you are installing on, though it is possible to install to a virtual server that you can remote into.  These instructions will not work for a shared hosting environment, that is, an environment where you do not have root access (otherwise known as administrative or super user access) to the server.&lt;br /&gt;
&lt;br /&gt;
=== Determining the CPU Type ===&lt;br /&gt;
&lt;br /&gt;
The following instructions assume you are installing on a 64-bit machine. You can determine if your machine is 64-bit capable by looking up your CPU by model number.  You can generally find the CPU type in the BIOS Setup, which is normally accessed on boot by pressing a function key or the delete key.  Intel CPU model numbers tend to look like a letter and 4 numbers, for instance: T7600.  Once you have the CPU model, you can verify it has a 64-bit instruction set by looking up the CPU on Intel&#039;s site.  For instance:&lt;br /&gt;
&lt;br /&gt;
* 64-bit CPU: http://ark.intel.com/products/27257/intel-core2-duo-processor-t7600-4m-cache-2_33-ghz-667-mhz-fsb&lt;br /&gt;
* 32-bit CPU: http://ark.intel.com/products/27235/Intel-Core-Duo-Processor-T2400-2M-Cache-1_83-ghz-667-mhz-fsb&lt;br /&gt;
&lt;br /&gt;
Most modern CPUs are 64-bit.&lt;br /&gt;
&lt;br /&gt;
These instructions have not been tested on a 32-bit machine.  However, they should work with minimum changes.  If you are planning to install on a 32-bit machine, you should download the x86 image: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-i386.iso&lt;br /&gt;
&lt;br /&gt;
== Create Bootable Media ==&lt;br /&gt;
&lt;br /&gt;
# Download Ubuntu Server 12.04.3 LTS 64-bit: http://releases.ubuntu.com/precise/ubuntu-12.04.3-server-amd64.iso&lt;br /&gt;
# Determine if you will be writing the ISO file to a CD or a USB drive.&lt;br /&gt;
## CD: simply write the ISO image to a writable CD.  Detailed instructions are available here for many operating systems: https://help.ubuntu.com/community/BurningIsoHowto&lt;br /&gt;
## USB drive: writing to a USB drive can be a bit tricky.  It&#039;s suggested that you use Linux Live USB Creator on Windows (http://www.linuxliveusb.com/en/home).  Detailed instructions (and instructions for other OSes) can be found here: https://help.ubuntu.com/community/Installation/FromUSBStick&lt;br /&gt;
&lt;br /&gt;
== Install Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
This section assumes you have physical access to the machine.  Generally, a virtual server host will automate this step.&lt;br /&gt;
&lt;br /&gt;
More detailed install instructions can be found here: https://help.ubuntu.com/lts/serverguide/installing-from-cd.html&lt;br /&gt;
&lt;br /&gt;
# Boot your Ubuntu media.  This may require you to either hold down a key during boot or change the boot device order in the BIOS settings.  Instructions vary depending on your model of server.&lt;br /&gt;
# You will be prompted to choose a language.  Choose the appropriate language.&lt;br /&gt;
#:[[File:Screenshot01.png]]&lt;br /&gt;
# Choose the option &amp;quot;Install Ubuntu Server&amp;quot;&lt;br /&gt;
#:[[File:Screenshot02.png]]&lt;br /&gt;
# Select your language once again.&lt;br /&gt;
#:[[File:Screenshot03.png]]&lt;br /&gt;
# Select your location.&lt;br /&gt;
#:[[File:Screenshot04.png]]&lt;br /&gt;
# Select your keyboard layout by allowing the installer to auto-detect it.&lt;br /&gt;
#:[[File:Screenshot05.png]]&lt;br /&gt;
# At this point, your server will try to configure its network connection.  Generally, the network will be configured automatically.  If your network configuration fails, you will have to configure it manually.  Speak to your network administrator or hosting company for the proper configuration values.&lt;br /&gt;
# Enter a hostname for this machine.  If this machine already has a name on your network, use that.  This does not include the domain name.  For example, &amp;quot;server01&amp;quot; and not &amp;quot;server01.example.com&amp;quot;.&lt;br /&gt;
#:[[File:Screenshot06.png]]&lt;br /&gt;
# Enter in the real name of the initial user.&lt;br /&gt;
#:[[File:Screenshot07.png]]&lt;br /&gt;
# Choose a name for the initial user.  This user will have administrative privileges but will not be a super-user.&lt;br /&gt;
#:[[File:Screenshot08.png]]&lt;br /&gt;
# Choose a password for the initial user and verify it.&lt;br /&gt;
#:[[File:Screenshot09.png]]&lt;br /&gt;
# Choose to not encrypt your home folder.&lt;br /&gt;
#:[[File:Screenshot10.png]]&lt;br /&gt;
# Choose your timezone.&lt;br /&gt;
#:[[File:Screenshot11.png]]&lt;br /&gt;
# Choose to use Guided Partitioning, using the entire disk, with LVM.&lt;br /&gt;
#:[[File:Screenshot12.png]]&lt;br /&gt;
# Select the proper disk.&lt;br /&gt;
#:[[File:Screenshot13.png]]&lt;br /&gt;
# Write the changes to disk.&lt;br /&gt;
#:[[File:Screenshot14.png]]&lt;br /&gt;
# Choose to use the entire disk again.&lt;br /&gt;
#:[[File:Screenshot15.png]]&lt;br /&gt;
# Verify you will write changes to the disk again.  The base system should now install.&lt;br /&gt;
#:[[File:Screenshot16.png]]&lt;br /&gt;
# Setup an HTTP proxy, if you need one.&lt;br /&gt;
#:[[File:Screenshot17.png]]&lt;br /&gt;
# Choose to install automatic updates.&lt;br /&gt;
#:[[File:Screenshot18.png]]&lt;br /&gt;
# Choose to install the OpenSSH server.&lt;br /&gt;
#:[[File:Screenshot19.png]]&lt;br /&gt;
# Install GRUB to the master boot record.&lt;br /&gt;
#:[[File:Screenshot20.png]]&lt;br /&gt;
# Reboot.&lt;br /&gt;
#:[[File:Screenshot21.png]]&lt;br /&gt;
&lt;br /&gt;
== Domain Names ==&lt;br /&gt;
&lt;br /&gt;
The remainder of these instructions assume you have a host and domain name configured externally for the server.  A domain name server maps the server&#039;s IP address to a name, for instance 10.1.1.2 to server01 (or server01.example.com if the domain name is &amp;quot;fully qualified&amp;quot;).  If you don&#039;t have an external domain name server, some of the following instructions will not work.  You can either speak with your network administrator to get a DNS (domain name server) entry created, or you can modify the &amp;quot;hosts&amp;quot; file of the computer from which you will be configuring the server.  The following link describes how to modify your &amp;quot;hosts&amp;quot; file on Windows, Mac OS, and Linux: http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file&lt;br /&gt;
&lt;br /&gt;
Add the following entry into the &amp;quot;hosts&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10.1.1.2 server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace 10.1.1.2 with the IP address of your server and &amp;quot;server01&amp;quot; with the host name of your server.&lt;br /&gt;
&lt;br /&gt;
== Remote Access ==&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login to your server using SSH.  SSH stands for secure shell.  It allows you to bring up a command prompt from another machine.  If you are on Mac OS or Linux, you can open a Terminal and type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh user@server01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user&amp;quot; with the user you created while installing and &amp;quot;server01&amp;quot; with your server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, it&#039;s suggested you use PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.  Documentation is available here: http://the.earth.li/~sgtatham/putty/0.63/htmldoc/Chapter2.html&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t login, there&#039;s a chance there&#039;s a problem with your network configuration.  SSH uses port 22.  Verify it&#039;s not being blocked by a firewall by speaking with your network administrator.&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Once your computer has rebooted, login using the username and password you created during the install process.  The remainder of this tutorial assumes a basic familiarity with Bash, navigating folder structures from the command prompt in Unix based environments (Linux, Mac OS, etc...), editing text files, and scripting.  If you aren&#039;t comfortable with these topics, here are several tutorials that may help:&lt;br /&gt;
&lt;br /&gt;
* https://help.ubuntu.com/community/UsingTheTerminal&lt;br /&gt;
* https://help.ubuntu.com/community/CommandlineHowto&lt;br /&gt;
* https://help.ubuntu.com/community/Beginners/BashScripting&lt;br /&gt;
&lt;br /&gt;
=== Using sudo ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;sudo&amp;quot; command allows you to run commands as a super user (Super User DO) without being a super user yourself.  Because this guide is focused on administrative configuration of a server, many of the commands are proceeded by &amp;quot;sudo&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When running a command prefixed by sudo, you will be prompted to enter your password.  For the next 15 minutes, you will not have to enter your password.  However, if you walk away from the computer and the screen blanks, or more than 15 minutes elapses, you will again have to enter your password.&lt;br /&gt;
&lt;br /&gt;
=== Update Packages ===&lt;br /&gt;
&lt;br /&gt;
At the command prompt, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude update&lt;br /&gt;
sudo aptitude full-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the prompt, and after the upgrade is complete, install apache, vsftpd, and incron:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo aptitude install apache2 vsftpd incron&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, reboot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
From the command prompt, switch to the following folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /etc/apache2/sites-available&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a new site by creating a new text file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Paste the following content into the file, changing the ServerAdmin, ServerName, and ServerAlias to values that make sense for your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAdmin admin@example.com&lt;br /&gt;
        ServerName www.example.com&lt;br /&gt;
        ServerAlias example.com&lt;br /&gt;
&lt;br /&gt;
        DocumentRoot /srv/ftp/home&lt;br /&gt;
        &amp;lt;Directory /srv/ftp/home/&amp;gt;&lt;br /&gt;
                Options FollowSymLinks&lt;br /&gt;
                AllowOverride None&lt;br /&gt;
                Order allow,deny&lt;br /&gt;
                allow from all&lt;br /&gt;
        &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
&lt;br /&gt;
        # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
        # alert, emerg.&lt;br /&gt;
        LogLevel warn&lt;br /&gt;
&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O.  Next, enable the site by making a symbolic link:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo ln -s ../sites-available/asserver ../sites-enabled/asserver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, make the document root specified above:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, restart apache:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify that you receive a forbidden error when navigating to your server in a web browser.  If you place an html file in your web root, you should be able to navigate to that as a further test.&lt;br /&gt;
&lt;br /&gt;
=== Configuring VSFTPD ===&lt;br /&gt;
&lt;br /&gt;
Using nano, make the following modifications to /etc/vsftpd.conf:&lt;br /&gt;
&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;write_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Change &amp;lt;code&amp;gt;anonymous_enable=YES&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;anonymous_enable=NO&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_enable=YES&amp;lt;/code&amp;gt;&lt;br /&gt;
* Uncomment &amp;lt;code&amp;gt;local_umask=022&amp;lt;/code&amp;gt;&lt;br /&gt;
* Add the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
delete_failed_uploads=YES&lt;br /&gt;
pasv_min_port=50000&lt;br /&gt;
pasv_max_port=50100&lt;br /&gt;
port_enable=NO&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
passwd_chroot_enable=YES&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add an FTP user to the system, and set its home folder to &amp;quot;/srv/ftp/./home&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser ftpuser&lt;br /&gt;
sudo usermod -m -d /srv/ftp/./home ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give ftpuser rights to /srv/ftp/home:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart vsftpd:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo /etc/init.d/vsftpd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Verify you can upload files by connecting via FTP as the user you just completed.  They should appear in the web root.&lt;br /&gt;
&lt;br /&gt;
=== Creating the proper folder structure ===&lt;br /&gt;
&lt;br /&gt;
Start by creating the folders to support template uploads and setting their permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates&lt;br /&gt;
sudo touch /srv/ftp/AS_UPLOAD_COMPLETED/.locked&lt;br /&gt;
sudo chown ftpuser:ftpuser /srv/ftp/AS_UPLOAD_COMPLETED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make template folders for all the versions of AppStudio you wish to support - for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir -p /srv/ftp/templates/3.3.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Uploading the &amp;quot;as&amp;quot; Folder ===&lt;br /&gt;
&lt;br /&gt;
First, you will need to locate the &amp;quot;as&amp;quot; folder, and upload it to your home folder.  The directions vary by operating system.&lt;br /&gt;
&lt;br /&gt;
==== Windows ====&lt;br /&gt;
&lt;br /&gt;
* Navigate using Windows Explorer to &amp;quot;C:\Program Files (x86)\NSB AppStudio\&amp;quot;.  On older systems, the folder may be &amp;quot;Program Files&amp;quot; without the &amp;quot;(x86)&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Download and install an SFTP client, such as WinSCP: http://winscp.net/eng/index.php&lt;br /&gt;
* Connect to your server using the following instructions as a guide: http://winscp.net/eng/docs/guide_connect&lt;br /&gt;
* WinSCP should default it&#039;s remote location to your home folder on the server.  Upload the &amp;quot;as&amp;quot; folder on your desktop to your home folder using the following instructions as a guide: http://winscp.net/eng/docs/guide_upload&lt;br /&gt;
&lt;br /&gt;
==== Mac OS ====&lt;br /&gt;
&lt;br /&gt;
* Navigate to the &amp;quot;Applications&amp;quot; folder on &amp;quot;Macintosh HD&amp;quot;.&lt;br /&gt;
* Find the AppStudio icon and right click on it.&lt;br /&gt;
* Choose &amp;quot;Show Package Contents&amp;quot;&lt;br /&gt;
* In the Finder window that appears, navigate to &amp;quot;Contents/Resources&amp;quot;.&lt;br /&gt;
* Copy the &amp;quot;as&amp;quot; folder to your desktop.&lt;br /&gt;
* Open the Terminal application in Mac OS, and type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd ~/Desktop&lt;br /&gt;
scp -r as user@server01:.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be sure to replace &amp;quot;user&amp;quot; and &amp;quot;server01&amp;quot; with your username and server&#039;s hostname.&lt;br /&gt;
&lt;br /&gt;
==== Copying &amp;quot;as&amp;quot; to the Template Folder ====&lt;br /&gt;
&lt;br /&gt;
Finally, copy the &amp;quot;as&amp;quot; folder to the template folder you created.  While logged into your server, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp -R ~/as /srv/ftp/templates/3.3.x/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring incron ===&lt;br /&gt;
&lt;br /&gt;
First, create the link script in the template folder with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the following into link.sh using nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
if grep --quiet &#039;&amp;lt;meta name=&amp;quot;generator&amp;quot; content=&amp;quot;NSB/AppStudio 3.*&amp;quot; /&amp;gt;&#039; /srv/ftp/home/$1/index.html; then&lt;br /&gt;
    ln -s /srv/ftp/templates/3.3.x/* /srv/ftp/home/$1&lt;br /&gt;
fi&lt;br /&gt;
# add elif lines for more templates&lt;br /&gt;
&lt;br /&gt;
rm /srv/ftp/AS_UPLOAD_COMPLETED/$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file using Ctrl-O and mark it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chmod a+x /srv/ftp/templates/link.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next you need to configure incron for ftpuser.  First allow ftpuser to use incron by creating the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/incron.allow&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file and save with Ctrl-O:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ftpuser&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit ftpuser&#039;s incrontab:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo incrontab -u ftpuser -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This brings up an editor.  Paste the following content into the editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/srv/ftp/AS_UPLOAD_COMPLETED IN_CLOSE_WRITE /bin/bash /srv/ftp/templates/link.sh $# &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the content with Ctrl-O.  Incron should now be configured.  You can verify this by creating a folder in /srv/ftp/home and then creating a file in /srv/ftp/AS_UPLOAD_COMPLETED that shares the folder&#039;s name.  The file you created should be removed and the folder should contain a link to your template.&lt;br /&gt;
&lt;br /&gt;
== Uploading &amp;amp; Verification ==&lt;br /&gt;
&lt;br /&gt;
If everything has been configured correctly, you should be able to connect via FTP upload files using AppStudio&#039;s protocol, described below.&lt;br /&gt;
&lt;br /&gt;
=== AppStudio Upload Protocol ===&lt;br /&gt;
&lt;br /&gt;
AppStudio uploads projects to a test server with the following steps:&lt;br /&gt;
&lt;br /&gt;
# Choose a unique prefix for the folder based on the user&#039;s registration.&lt;br /&gt;
# Connect via FTP and upload the prefixed project folder into the ftp home folder.&lt;br /&gt;
# Change folders to ../AS_UPLOAD_COMPLETED and drop a file in that folder that matches the name of the folder you just uploaded.&lt;br /&gt;
&lt;br /&gt;
You can follow these steps manually to test the system.&lt;br /&gt;
&lt;br /&gt;
=== Verification ===&lt;br /&gt;
&lt;br /&gt;
If the system is working properly, a symbolic link to the template should have appeared in your project&#039;s folder after uploadng.  Also, the file uploaded to AS_UPLOAD_COMPLETE should have been removed.&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot20.png&amp;diff=5287</id>
		<title>File:Screenshot20.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot20.png&amp;diff=5287"/>
		<updated>2014-01-20T22:33:05Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot19.png&amp;diff=5286</id>
		<title>File:Screenshot19.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot19.png&amp;diff=5286"/>
		<updated>2014-01-20T22:32:55Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot18.png&amp;diff=5285</id>
		<title>File:Screenshot18.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot18.png&amp;diff=5285"/>
		<updated>2014-01-20T22:32:46Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot17.png&amp;diff=5284</id>
		<title>File:Screenshot17.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot17.png&amp;diff=5284"/>
		<updated>2014-01-20T22:32:37Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot16.png&amp;diff=5283</id>
		<title>File:Screenshot16.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot16.png&amp;diff=5283"/>
		<updated>2014-01-20T22:31:48Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=File:Screenshot15.png&amp;diff=5282</id>
		<title>File:Screenshot15.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=File:Screenshot15.png&amp;diff=5282"/>
		<updated>2014-01-20T22:31:37Z</updated>

		<summary type="html">&lt;p&gt;James: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>James</name></author>
	</entry>
</feed>