Introduction: Android Personal Home Server
This tutorial will cover an Android Home Server using my unofficial app MyHomeServer.
With this app you can connect your Android phone or tablet to other devices connected to the same WiFi network (at home, work...) and explore it via Web browser . The app doesn't work on cellular networks.
The server has an authentication page and a management page that will be explained later.
The app also support dynamic DNS trought No-IP or DuckDNS and it's explained later in this tutorial.
Using a web browser you can download/upload/delete/rename files and folders and host your webpage at home on your device.
So, what can i do with this? Some examples:
-Share photos on your device with friends and family or show them on a PC or smart TV...
-Host your own web page and amaze your friends...
Step 1: Download and Install the App
1) Download the Android app from here and copy it on your device's SD card (no matter if internal or external).
The app is made by me, is advertising free, virus free and doesn't collect personal information. I always suggest to check it with your preferred antivirus before install.
This app is compatible with android 2.3.6 up to android 6
2) If you are familiar with Android probably you already enabled the Unknown sources. Anyway go to Settings> Security> Phone Administration and tick (enable) on Unknown sources. Please note that the path could be different from device to device.
3) With the default File manager app point to the MyHomeServer.apk file copied before and click on it. The installation process should start. Choose INSTALL then DONE.
4) If all goes well you will see the new installed app icon: MyHomeServer
Attachments
Step 2: Set Up the App
This step isn't mandatory as the app already has a basic setting to run immediately after installation.
Anyway here is an explanation of the available settings except for No-IP and DuckDNS that are not covered by this tutorial for now, as said before.
1) Start the app and click on the big Server configuration button (also reachable from the 3 dot menu or menu button on your device) and confirm to stop the server in the Change Settings dialog, the settings menu will open...
2) Settings explained from TOP to BOTTOM:
- Server autostart: tick to start the server automatically when you start the app.
- App autostart: tick to start the app automatically when the device boots, if enabled togheter with Server autostart, the server is always available on the device, no need to start manually. Useful if you have an old device at home to use as server and always powered on..
- DynDNS autoupdate: the time (in minutes) after that the server looks if your router's IP has changed. Useful only with No-IP and DuckDNS services. This is explained later.
- DynDNS service: allow you to choose the service for your server from No-IP, DuckDNS and INTRANET (default). must be INTRANET if you don't use a dynamic DNS service.
- No-IP settings: enter your No-IP account details here if you choose No-IP service.
- DuckDns settings: enter your DuckDns details here if you choose DuckDns service.
- Server Administration username and password: choose an username and password to access the server from the web browser. Default are user: Android, password: Android. Change them as you like.
- Auto Log Off: the time (minutes) after that the server asks for authentication again if no activity is detected.
- Folder exploration: if you tick it then only folders inside the app can be accessed. This is a security setting as files and folders can be modified from the connected client. Anyway if you plan to share photos with other this setting must not be enabled as photos are outside the app folders.
- Logs expiration (days): server logs are automatically created and saved every day in a new text file (when using the app). Files are in the 'maintenance' folder of the app and can be opened with the browser. Logs older than thespecified number of days are deleted when the app starts.
- Website basics home page: this is the filename of the first page you will see when connecting to the server with the browser. If you will build your own web page this setting must match the first page to start from.
Step 3: Connecting to the Server...
Now you are ready to test the connection...
Note that to get all things working you need the device running the app and another device with a web browser both connected to the same WiFi network!
1) Start the app and make sure the server is running: the first big button on top must show a green led when the server is started and red when the server is stopped.
2) Open the web browser on a PC, phone, tablet ... and type in the address bar the IP address shown in the server main page under Server info>Device status and IP. For example look at the image: the IP in this case is 192.168.1.7:5555
3) after a little (depend on the router) the browser should show the server default home page with the Under construction image and the Login button. Click on it and in the login page enter username: Android , password: Android or the credentials you set in the previous step if changed.
If you get problem connecting to the server try reload the page, turn the display on or power the device with the AC adapter (in some devices the standby mode slows down operations due to deep sleep).
4) After submitting, the welcome back (username) page should open. Click on continue and go to the next step...
Step 4: The Administration Page
This page is the most important as it allow to:
- copy files to server.
- download files from server
- navigate folders
- create folders
- rename files/folders
- unzip files in the current folder
- backup files (for example all files uploaded for your own website)
Using this page is quite simple. The page has 2 panels: on the left panel you can work with files and folders, the right panel is the files and folders navigation. At bottom there is a link to return to the main page and logout automatically.
- The right panel:
The first link on top of the right panel allow you to refresh the file list. Normally there isn't need for this as it is done automatically when you navigate files/folders or make changes on the left panel.
Under that link there is the actual path (where you are).
The first folder (with the arrow) will bring you up one level in the directory tree. This folder is followed by a list of folders (if there) and files (if there) found in the current path.
Now try navigate to your DCIM/Camera folder to see some of your photos (these could be in the internal memory or external SD card of your device depending on it's configuration). Before doing this make sure that theFolder exploration Limit setting of MyHomeServer is disabled (see Step2) otherwise you will not able to explore that folder.
When you reach the correct folder you should see something like in image1 of this step.
Click on a photo to open it in the web browser. You can do all files operations supported by your browser as usual internet browsing except for streaming music/video that is not supported by MyHomeServer.
Now navigate back to the app folders as in image2 of this step.
- The left panel:
Now try create a new directory: type a name, (test folder for example), in the Create a directory box and click Create directory, the new folder will appear in the right panel. Click on it to open, it's empty.
Upload a file in this directory by clicking select file then upload the file in the left panel >upload files tab. Your file will appear in the folder you created before.
Note that file upload is slower than download. In some cases the device should be kept ON or powered by AC adapter to keep the CPU running faster and get more speed.
In the same way you can delete files using the Delete a file or a directory tab. Make sure to not delete important files: there isn't an UNDO function.
Step 5: Create Your Own Hello World Web Page...
Now it's time to create your own web page.
First of all, if you don't know nothing about HTML language i suggest to start (or search on) here:
http://www.w3schools.com/
For this step download the hello.zip file.
Open it, connect and login to your web server and upload the hello.html and the login.jpg.
Now logout from the server by clicking the link at the bottom.
Open the server settings and change the Home page to 'hello.html'
Connect to the server again with the browser and you should see a new page like in the image in this step.
Try to login to enter the administration page.
Now open the hello.html file with your preferred text editor and, based on your experience or by reading the link above, try modify it (colors, texts, background, add images...) and upload to server. In this way you can personalize your welcome page and amaze your friends :)
It recommended to not remove this part of code as it needs to enter the administration page:
<!-- login to enter the server with the browser --><br><div align="center"><br><a href="/maintenance/login.html" target="_parent"><br><img border="0" alt="Please login" src="login.jpg" width="300" height="120"><br></a><br></div>
Anyway if you do mistakes please enter the server settings and change the Home page back to 'working.html'
And finally here is an example of an internet enabled version of this webserver using the DuckDNS DDNS service (just to see the powerful of the app...):
http://appsbydavidev.duckdns.org/
Enjoy :)
Step 6: Access MyHomeServer From Internet With a Dynamic DNS Service
Warning: this step requires changing the configuration of your router, you should back up your configuration before you change something. For backup please referr to your router's manual. I am not responsible for loss or problems to the router configuration.
- Choose your preferred DDNS online service, the app supports No-IP and DuckDNS.
I suggest to read pros and cons on their websites.
Basically:
No-IP is well known and has a free and a paid offer, the free offer is good but requires you to confirm monthly your account.
DuckDNS is completely free, i'm using it without problems.
The service to use is up to you. - NO-IP: register to NO-IP, choose the free offer and add an host (image3), you should be prompted for a name for your website (host name). They add automatically their domain, for example if you choose thisismyname as host the complete address became thisismyname.ddns.net
Write down the FULL host name , your password and your username and input them in the server app settings under NO-IP settings. - DuckDNS: register to DuckDNS, in your account add a subdomain name (image2) , for example thisismyname .they automatically add their domain and the full path for your website will be thisismyname.duckdns.org
Write down the subdomain only (thisismyname in this example) and the token key and input them in the server app settings under DUCKDNS settings. - In the server app settings click on DynDNS service and select the service you choose above.
Click also on DynDNS autoupdate (minutes) and enter the time interval after that the app checks and renews your router's ip address. A value from 10 to 30 minutes is good.
The IP address is checked when the app starts and can be forced by clicking on the Force DDNS button.
Also the app checks the IP when WiFi connection is lost.
Step 7: Router Configuration
Warning: this step requires changing the configuration of your router, you should back up your configuration before you change something. For backup please referr to your router's manual. I am not responsible for loss or problems to the router configuration.
Since every brand has different configuration pages in their router please take this step as an example and referr to your specific router manual to found right settings based on this explanation.
In order to be accessed from the internet your router needs some configurations:
A) Port forwarding for external access
B) DHCP reservation to assign a static IP address to your android device into your home network.
In the image 1 you can see settings for a D-Link dsl2750B router for ADSL+
Enter your router's setup page with a web browser using a lan cable (recommended) or via WiFi network (referr to your router's manual for the default address), usually you will be prompted for an username and password, find them in the manual too.
- Search the 'Port forwarding' settings page.
- In the 'Port forwarding SETUP' click 'ADD' and enter the informations from your server app main screen as in image3, for example if you see your IP address as 172.17.2.34:5555 enter:
Internal port start: 5555
internal port stop: 5555
Server IP address: 172.17.2.34
External port start: 80
External port stop: 80
Protocol: TCP
Server name: this could not be mandatory, anyway choose a name as you like - Confirm settings done in this page if necessary.
- Search the 'Local network' settings page.
- In the DHCP Reservations list click 'ADD' and enter the informations from your server app main screen, 'Device name for your router' :
Computer name: the device name you see in the app be sure to write it correctly.
Mac address: hopefully you should choose from a list, otherwise go to your device settings>Device info>Status and write down the Wi-Fi MAC address and copy here.
IP address: write the IP address shown by the app (image3) without the colon and the part after that
(in example without :5555) - Confirm settings done in this page if necessary
Depending on routers it may ask for a reboot to apply changes, follow your router's dialogs if displayed.
When you are done with the router and checked it is working as usual go to the server app.
Click on the big button 'Force DDNS Ip update' and you should see Success , the led should be green.
Open a web browser from a device NOT connected to the same network, for example try with a phone using 3G, in the browser type in the address bar the complete name you choose in the previous step, for example:
thisismyname.ddns.net or thisismyname.duckdns.org
If all went well you should see your server home page, try access the maintenance page and play with :)