Here’s a little tutorial on how to setup your own personal web server, on nothing but your existing computer equipment. Notice, I am using my MacBook Air, which I have installed VirtualBox onto – But any laptop or computer will suffice. On my VirtualBox I have created a Linux virtual machine, which I have installed a fresh Ubuntu Server 16.04.3 LTS on top of.
First download and install VirtualBox. Then download Ubuntu Server. Create a new Linux type of virtual machine, by clicking the “New” button in VirtualBox. When you start your virtual machine, you’ll be asked to point it to an ISO image, at which point you can point it to your Ubuntu server download .ISO file.
Notice; Keyboard mapping is a nightmare between a Mac, through VirtualBox and into Linux. Hence, it might be beneficial to choose to install SSH during the installation, and such use your Mac terminal, to SSH into your machine as you run through the rest of these scripts. At the very least, make sure you pick the right keyboard layout. Meaning, if you’re on a Mac host operating system, make sure you choose Mac keyboard. That way, at least you’ll have “less trouble”.
During the installation, I choose the “default” installation, without anything extra stuff, such that I could control how to install Apache and MySQL on it afterwards. You might benefit from adding SSH support, especially since keyboard mapping is a nightmare, especially from Mac OS X, through VirtualBox, and into Ubuntu. Hence, the only practical way to actually be able to create some of the more special characters, will be by SSH’ing into your system, from your host Mac OS.
When your virtual machine is up running, it’s important that you set its network settings into “Bridged Adapter”. You must shut down your virtual machine to do this, for then to click “Settings/Network” on your machine in VirtualBox. Below is a screenshot of how this looks like for me, on my Mac. To shit down the machine, click CMD+Q on a Mac, and choose to turn it off. Then modify your virtual machine’s settings
Then start your Ubuntu server, login, and start configuring it. Type in the following at your terminal from within your Ubuntu machine.
sudo apt-get install apache2
sudo apt-get install mysql-server
The first line will install Apache, the second will install MySQL. During the installation process of MySQL, you will be asked to supply a password. Remember this password, since we’re going to have to modify Phosphorus Five’s web.config file, to add this password into it. Then type in the following.
sudo apt-get install mono-complete
sudo apt-get install libapache2-mod-mono
sudo apt-get install unzip
These three lines install Mono, mod_mono which are Apache bindings for Mono, and unzip, since the binary download for Phosphorus Five is only distributed in zip file format at the time being. You might get away with installing only some sub portion of Mono, since the above will pull in everything. However, this is left as an exercise for the brave at heart to figure out.
Then we need to download Phosphorus Five. This can be done with the following command from your terminal.
After the download is complete, unzip the file, with the following, copy its content to your main www root directly, and delete the default index.html file.
sudo cp -R p5/* /var/www/html
sudo rm /var/www/html/index.html
Change the MySQL password in the web.config file for P5, by typing the following into your terminal.
sudo nano /var/www/html/web.config
The connection string to MySQL is some ways down in this file, so use your arrow down key, until you can see the following key “MYSQL_GENERIC_CONNECTION_STRING”. Add “password=YOUR_MYSQL_PASSWORD;” after the “User ID=root;” parts. Make sure you type in the actual password you used during installation of MySQL, and not the placeholder password in my example. When you’re done, click CTRL+O to save this file, and CTRL+X to close “nano”, which is the editor you just used to edit your web.config file.
Afterwards, you must give the Apache process ownership over the entire root WWW folder. This can be done with the following.
sudo chown -R www-data:www-data /var/www/html
This will allow the Apache process to create and delete files in your WWW root folder, which is necessary for Phosphorus Five to function correctly, since among other things, it allows you to install apps, from within your browser. Notice, we could have fine grained this further, by only giving it access to “db”, “auth.hl” and “modules”. However, for simplicity, we just gave it control over everything. In a real live environment, where security demands are higher, than our little example – You might want to take a more “fine grained” approach. Feel free to experiment here.
Then we’ll need to install GnuPG, to host our PGP keys.
sudo apt-get install gnupg2
GnuPG requires a folder, if it is to be used in combination with Apache, which you can create with the following command.
sudo mkdir /var/www/.gnupg
Then Apache must be given ownership over that folder too, which can be done with the following command. Notice, P5 downloads, installs, and reads your GnuPG keys – Hence, it’ll need complete access to everything within this folder.
sudo chown -R www-data:www-data /var/www/.gnupg
The last command, allows Phosphorus Five to download new keys, and read PGP keys, which belongs to the Apache process’ user.
P5 does its own URL rewriting. This means that we must slightly change the default mod_mono configuration, to also allow all requests that aren’t requests for files, to be automatically forwarded to ASP.NET. This is done by editing your mod_mono file, which can be done with the following command.
sudo nano /etc/apache2/mods-enabled/mod_mono_auto.conf
The above will open up nano, again, which is our text editor of choice, at which point you can add the following somewhere just before the first “DirectoryIndex” setting.
<Files ~ "\.hl">
Deny from all
Deny from all
Deny from all
The above setting will force all URLs that doesn’t contain a “.” within them, to be forwarded to ASP.NET, making a URL such as for instance “/bazar” to be handled by P5. In addition, it will prevent serving any Hyperlambda file. After that, it will prevent anything from within the “/users” and “/common” folders to be served. Save your file with CTRL+O, and quit nano with CTRL+X.
Afterwards, you’ll have to modify your Apache instance, to disallow the browsing of folders. This is done by opening up your main Apache configuration file, with the following command; “sudo nano /etc/apache2/apache2.conf”. Then replace the parts which says.
Options Indexes FollowSymLinks
Require all granted
Remove the “Indexes” by replacing it with the following.
Require all granted
Notice, this is where it starts getting difficult actually using your terminal inside of Linux directly, due to keyboard mappings. If you want to, you can check out your server IP address, using the following; “ifconfig | grep addr”, for then to connect to your Ubuntu server using SSH, with the following “ssh firstname.lastname@example.org”, where the “x parts” is your AP address of your Ubuntu server.
At this point we’re done, and all you’ll need to do, is to restart Apache with the following command.
sudo service apache2 restart
Now, all you’ll have to do, is to figure out your Ubuntu server’s IP address, which you can do with the following.
ifconfig | grep addr
On my Ubuntu Server, this shows me “192.168.0.21”. If you go to that URL with your browser on your “host operating system”, which for me is my MacBook Air, it should load up Phosphorus Five, and ask you for a server salt. It should resemble something like the following, from the beginning of the following video.
Type in some server salt, create a root password, and voila! You’re now up running. Though, you’ll still need to expose this Ubuntu Server to the internet, in your router. For most, this would be done by visiting “192.168.0.1” in your browser. This shows me the following.
But the above might vary according to which internet provider you’re using, and which router they’ve given you. Typically, if you Google the router’s name, and type, which often is a weird number – You’ll find login instructions to the admin interface of your router.
At this point, you’ll want to forward port 80 to your Ubuntu Server’s IP address. For my router, this is accomplished by clicking “Application and Gaming/Port Range Forwarding”, and making it forward all HTTP requests, by adding a rule that forwards all requests on port 80 to my Ubuntu server’s IP address. Look at the screenshot below to see how you could do this.
Then make sure you save your settings!
At this point, you can visit e.g. What’s my IP, to figure out your external IP address, and simply type in that IP address in your phone or tablet, and you should be able to see your website. Congratulations, you have now setup your own personal web server, and cloud.
Warning!! This website is not encrypted, which means it’s not safe to use for data, which you consider to be private, since your password is passed in as clear text. To get your site encrypted, using SSL, you can for instance get an SSL certificate at Let’s Encrypt, configure Apache to use it, and forward port 443 to also point to your Ubuntu Server’s IP address. If you do, you’d probably want to close down your port 80 rule, to avoid accidents when typing in your password in your P5 home cloud system. Alternatively, create a 302 HTTP redirect rule, or something, in Apache, which forwards all HTTP requests to HTTPS, or something. Feel free to comment in this blog, if you’ve got a nice recipe for this …
Then the only remaining thing left to do, is to remember to have fun. Below you can see me demonstrating my own personal home cloud 🙂
At this point, you can simply plug your computer into a permanent power supply, and simply avoid turning it off, and always have access to your “home cloud”.
Notice, most internet service providers don’t provide you with a static IP, unless you pay a handful of additional bucks for it per month or something. This means that every now and then, your server will change its IP address. If your website becomes unavailable, simply visit What’s my IP, again, and update your bookmarks to point to its new IP.
If you wish to have a static IP, or possibly even a domain, you could probably order a static IP for 3-5 dollars per month from your internet service provider, and register a domain for $10 somewhere, and point it to your IP address. At which point you can visit your home cloud with a URL, such as “my-home-cloud.com”, or something …