2 servers, 1 cup

Actually its 1 IP-adress, but 2G1C jokes never get old!

Issue: I, as most others, only have one public IP.  I also got plans for several services I need to be able to connect to from outside my home and network. As mentioned in former posts, I’ll be running multiple virtual machines.

Solution: Reverse proxy. Yep, that is a expression I learned about a couple days ago.

Simple topology of a reverse proxy

After some intense googling (there seems to be absolutely no complete guides for this, unless you know exactly what to look for), I got it working. I used an old Raspberry Pi 2 Model B I had lying around. Its only purpose in life is pretending to be a real server…

Step 1 – Install Linux

Since I’m using a Raspberry Pi I installed raspbian, because its Debian based and I like Debian.

Step 2 – Install updates and Apache web server

Step 3 – Enable proxy and configuration

This will enable the proxy-module. Next up is configuring the config file.

I used this config:

The just restart the apache service.

 

This makes the Raspberry Proxy a landing site web-server. I directed a few subdomains to my public IP, and whenever I use one that is NOT defined in the config I get the proxy web site. Perfect!

VirtualBox server simulation

Instead of going straight to installing Linux on a server I want to do some test runs, just to see if everything actually works. I am not experienced enough to make any real security checks, but will try some guides I have found online for securing the server. On a virtual server I can mess up as much as I want, and just recover from an earlier snapshot if I want to revert back to where it worked.

Simple flowchart to show the process of using a virtual machine to test and troubleshoot an installation.
Simple flowchart to show the process of using a virtual machine to test and troubleshoot an installation.

Continue reading VirtualBox server simulation

Preparing for the Linux server

As mentioned earlier I am going to set up a Linux server for running different services, like the ownCloud “getting rid of Dropbox” experiment and other things. I have some experience using Linux, but usually end up doing stupid stuff that I cant find my way out of. This time however I plan to be a bit more systematic about it, and documenting the changes I make to make troubleshooting a bit easier.

Choosing Linux

Choosing between the multitude of Linux flavours can be hard, as it is a few to choose between. I have tried a few different ones, and for me the biggest differences lies in the GUI (which I wont use) and how stuff is installed.

The server of choice will be Debian. No particular reason really, but I like the package manager APT. I also really dont like Ubuntu, as I felt it was full of bloatware last I tried it. So a command line, only whats needed,  Debian server is what I trust to take care of my web server.

understandingdebian

Choosing the web server

Up until just a few days ago I thought apache/php/mysql was the way to go when you wanted to host a web server. After googling around for read-ups on security settings and other information around web servers I discovered NGINX. Its supposedly a lot faster than apache, and more future proof. All the facts and numbers they present to me had me convinced that this was the place to go. The ownCloud installation manual recommended apache, but in the same breath they write about requirements for up to 150 users. My installation will have 2 users, so I dont think I will notice much of a speed difference. Actually it would probably not matter at all if I went apache or NGINX for any of my applications, but sometimes I just have to do what I have to do.

I will also need to run a ruby on rails server. I am hoping this is as easy as it looks in the different installation manuals I have checked. I may have to read up on developing with ruby. There is a great resource for this here, but I have yet to find the time to dive into that.

Other than that I will most likely follow the install instructions for the services I want.

The web services

Here is the initial list of services, or web sites, I want installed on the server

  • ownCloud – This is for a local run Dropbox variant. All files will also sync to an offsite server for extra safety
  • Piwigo – This is the photo library of choice. It works fairly well, got lots of add-ons and is open source. All photos will be synced to an offsite server.
  • Thingspeak/data.sparkfun – This is for the data logging once I get the ESP8266 projects up and running. As of yet I have no preffered choice between the two, so both will be installed and tested. Also I dont think there is anything stopping me from logging data to both services simultaneous.

The hardware

The Linux server will be running on an old computer I got lying around. I was actually looking into buying an old real server, rack mounted with dual xeon processors and hot swap disks and what not. What I realised though was that those rack servers are about 70cm in depth, and my rack cabinet is about 45cm. Simple math then proves that this might not be as feasible as I first hoped. Until I can find a spot for a full size rack cabinet, and a spot to put it, I am stuck with my old desktop computers.

Full specs of the server:

  • Core 2 Duo E8200 2.66GHz
  • 16GB RAM
  • 120GB SSD + 2x1TB HDD
  • Single Gb ethernet

Definitely not a powerhouse of a server, but with 2 users I do believe it is more than enough to host a webserver. The harddisk space will be upgraded as needed.

So thats it for the server. Next up will be installing the software on a virtual machine, testing and documenting all the way. Hopefully I will be a little bit wiser about Linux when this is all done.

What all true nerds want. This is from facebooks datacenter in Sweden.
What all true nerds want. This is from facebooks datacenter in Sweden.