These are instructions on how to setup DigitalOcean droplet to host your personal website. DigitalOcean is a very affordable cloud hosting for developers (starting from $5 for a very simple droplet 512MB Memory / 1 CPU and 20GB disk).
DigitalOcean provides great documentation with step by step instruction about how to configure your servers to do what you need.
Certainly by building your own server you won't have the tools that Drupal sepcific hostings provide, such as Acquia or Pantheon and certainly I am recommending to use Drupal specific hosting for your clients because they provide much better support on a various levels, starting from server issues all the way to Drupal-specific issues.
While they have great support and pricing for businesses they don't have affordable plans for personal websites and that is the reason why I am writing this blog post. By following these instructions and configuring the servers yourself you will better understand how webservers work.
I won't rewrite all the instructions, instead I will include links to DigitalOcean's manuals with all the steps.
Note: When you create a droplet (server) you may choose preconfigured droplet with Drupal 8 already installed on it. However I prefer installing everything myself by following the steps you will learn new things.
We will be using Ubuntu 14.04, Ngnix, PHP7, MySQL 5.6. (LEMP stack). Please follow the instructions in the following order:
- Initial Server Setup with Ubuntu 14.0
- Once you complete initial server configuration make sure your server is secured. Please follow firewall configuration instructions: How To Set Up a Firewall with UFW on Ubuntu 14.04. Basically only allow 80 (http), 443 (https) and 22 (SSH) ports. Please read also UFW Essentials: Common Firewall Rules and Commands
- How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 14.04
- The link above will only install PHP5. In order to upgrade it to PHP7 use this: How To Upgrade to PHP 7 on Ubuntu 14.04
- If you would like to use Memcached with PHP7 follow this instructions: Installing PHP-7 with Memcached
- Once you have your server configured begin installing Drupal 8. Please see Nginx configuration settings for Drupal 8
If you would like to use Apache (LAMP stack) for your webserver please use this:
- Follow the same server conifguraiton from above.
- How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu
Once you complete all the steps above you should be able to see your site by accessing
There are a great number of instructions how to build high availability servers, of course this will cost more since you have to create multiple droplets, however for a personal site this is not needed. Make sure your servers are in the same datacenter region:
- How To Create a High Availability Setup with Corosync, Pacemaker, and Floating IPs on Ubuntu 14.04 read also about Floating IPs: How To Use Floating IPs on DigitalOcean
- How To Create a High Availability HAProxy Setup with Corosync, Pacemaker, and Floating IPs on Ubuntu 14.04 (complete the first instruction before starting this)
- How To Set Up MySQL Master-Master Replication
More interesting instructions:
- How To Set Up Automatic Deployment with Git with a VPS
- How To Set Up a Host Name with DigitalOcean
- How To Use the DigitalOcean Docker Application
- Any many more tutorials.
- How To Create an SSL Certificate on Nginx for Ubuntu 14.04
- Using SSL Certificates with HAProxy also read How can I use SSL behind a load balancer and still get the client IP?