Post on 29-Dec-2015
Scalable self-hosting with virtual machines
An example of how you can host your own Wordpress sites, or any other web
applications, with a minimum of fuss or clashes between sites
2
About the presenterChris has been in the tech industry for more than 20 years. He has been both the in-house and outsourced IT guy for over 50 local small businesses and started his own consultancy in April of 2015. He understands the difficulties facing a growing small business and can offer a measured perspective, founded on a solid base of experience.
4
Static IP address/business accountA normal residential service can change IP addressYou can add a static IP address to some home
accountsYour ISP might only offer it for
business accounts, and mayrequire an ABN(I strongly recommend getting
an ABN anyway)Nothing else should change
5
Configuring domains/subdomainsYou’ll need one or more of your own domainsUse your domain host’s
tools to add an A recordto your static IP address
You can then create asmany subdomains as youwant as C records (aliases)to your A record
6
VM host environment (Part 1)All you need is a spare old computer you can leave
on all the timeCPU barely matters, RAM is most usefulESXi & Linux-based QEMU solutions are free, just
download and installIf you have a Windows Server, you can use Hyper-VIf you have a desktop PC, you can use Vmware
Player
7
VM host environment (Part 2)My recommendation is
CentOS (www.centos.org)Grab a DVD ISO image and
burn to a DVD.Boot from disc and follow the
wizard.THIS WILL TOTALLY ERASE
EVERYTHING ON THECOMPUTER. Just so we’re clear.
Congratulations, you’re a Linuxuser. There’s probably a Meetupgroup for that.
8
Pre-built Wordpress VMYou don’t have to build your own virtual machinesI use Bitnami & Turnkey
Linux for my VMsYou can download a
pre-built environmentthat’s a workingWordpress install, or
You can download aLAMP VM and installWordpress yourself.
9
Getting it booting & live (Part 1)Your VM host environment will
have an option to import anexisting file
When setting up your VM, makesure the virtual network adapteris bridged, not NATed
10
Getting it booting & live (Part 2)In your DHCP server,
create a reservation.For most homes, the
router is the DHCP server.For most businesses, the
main server is the DHCPserver.
11
Getting it booting & live (Part 3)In your router, set up port forwarding.The IP address matches the reservation.
12
Quick ReviewComputer on all the timeStatic IP addressDomain with one or more
records pointed at static IPaddress
VM host environment oncomputer
Pre-build VM on hostDHCP reservation for VMPort forwarding on router
pointed at reserved IP
13
Now let’s make it scalableIn our set up so far, all the domain records
point to the same server.What if you want different servers for
different domains?The solution is a “Reverse Proxy”.
14
Nginx VMPronounced “engine x”Download and install a
pre-built VMSet up a reservationPoint the port 80 port
forwarding to this server
15
Nginx configuration (Part 1)Configure hosts file
Each line has the private IPaddress of the server and itsname as known by theoutside world.
This fixes some weirdredirection issues.
16
Nginx configuration (Part 2)Configure default enabled sites
For each domain/servername, pass incomingrequests to the matchingname you’ve set up inthe hosts file.
18
That seemed complicated…Yes, you could do most of this with a single
server, a single LAMP install, no virtual stuff and a lot of configuring.
BUT, changing it is hard.Scaling it up is hardAnd you’re stuck with one platform
19
I mean, really complicated…With this solution you can have any number of
physical and virtual servers.You can add and reassign resources much more easily.Servers do not have to be LAMP/WordPress installs.Servers can be any OS
For example; you can build a testing environment for your plug-ins that has a dozen or more different OS, stack and version combinations.
21
Router (10.1.1.1)203.59.72.34
ESXi10.1.1.34Windows Server10.1.1.202Linuxsvr01 (email relay)10.1.1.110Windows 10 test env.10.1.1.123
CentOS 1iwantmy.xyz (Telescope)10.1.1.17
Bamboo Invoices10.1.1.111
Disposals/Classifieds10.1.1.135
Helpdesk job tracking10.1.1.128
Podcast Slack invites10.1.1.126
ERP / Bookkeeping10.1.1.130
RSS server10.1.1.124
Technicalconsultingperth.com10.1.1.122
Nginx reverse proxy10.1.1.113
CentOS 2 10.1.1.104
Prebiotic.diet10.1.1.132
Dev/Test ERP system10.1.1.127
eBooksa.ga10.1.1.133
Satelliteup.link10.1.1.136
Munchausenbypro.xyz10.1.1.140
Technicalconsulting.in10.1.1.107Technicalconsulting.in/ternationalTechnicalconsulting.in/PerthTechnicalconsulting.in/AustraliaTechnicalconsulting.in/theUK