From the macOS Terminal (Applications -> Utilities) — or alternatives like iTerm — run this command
ssh-keygen -t rsa
Press the ENTER key to accept the default location, then enter a passphrase twice. This creates new files in your Mac User's folder at "~/.ssh/id_rsa.pub" and "~/.ssh/id_rsa". Run the following command to copy your key to your clipboard, for the next step:
pbcopy < ~/.ssh/id_rsa.pub
The minimal memory size of 1GB is sufficient to get off the ground.
If you have already setup your SSH Key with Digital Ocean before, select it. Otherwise, click the "New SSH Key" button and paste the contents of your key which was copied to your clipboard above.
Go to your domain registrar and setup Custom DNS Servers to...
Then return to Digital Ocean and go to the Networking area, where you can "Add a domain":
This will bring you to the domain's details, where you should add DNS Records. Add two "A Records" pointing to your newly created Droplet, one for hostname "@" and one for hostname "www"...
Once you receive your server's reset root password via email, you can log into your server via SSH. You can use Digital Ocean's button to "Launch Console", but other command line terminals (e.g. iTerm) will allow you to copy and paste things like your most secure passwords.
If your domain linkage has already propagated, you can SSH connect using your domain name instead of your server's IP address in this command:
This will prompt you for the temporary password you were emailed as "(current) UNIX password." Then you should enter a new, strong password twice when the server prompts you.
Run this series of commands, accepting defaults, and confirmations by pressing the Enter key. When you create a MYSQL password, be sure to copy and securely save it.
$ apt-get update
$ apt-get install tasksel
$ tasksel install lamp-server
$ apt-get install php-mbstring
$ apt-get install php-zip
$ apt-get install phpunit
Now edit this Apache file:
...and move index.php to the front of the list there:
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
Save a file in the 'nano' editor by clicking Control-X, "Save modified buffer?" type "Y" for Yes, then press enter to confirm overwriting the file with the same filename. Then restart Apache:
service apache2 restart
Create a new file in the default public root:
Type this, "<?php phpinfo(); ?>", into the empty file, and save it. If things are working, you should be able to type your IP address (or propagated domain name) into your browser, and see a bunch of details about your PHP installation.
Run this series of commands, accepting defaults, and confirmations by pressing the Enter key:
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar
$ apt-get install curl
$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
$ service apache2 restart
Down the line, you might want a GUI to play with your databases. I've enjoyed Sequel Pro.
Give your new SSH connection an appropriate name, and use your Droplet's IP address for the hosts. Copy the MYSQL root password you created while installing the core packages above.
Finally, link your SSH Key in your operating system, "~/.ssh/id_rsa.pub". This can sometimes be challenging since this is a hidden folder which you may need to work to reveal.
Once you are connected, use the drop-down in the top-left corner to "Add Database...". Give your database an appropriate name, and write it down for later.
$ rm /var/www/html/index.html
$ composer create-project laravel/laravel /var/www/laravel 5.3.*
$ rm /var/www/laravel/vendor/compiled.php
$ cd /var/www/laravel
$ composer update
$ php artisan key:generate
$ chown -R www-data:33 /var/www/laravel/storage
$ chmod -R gu+w /var/www/laravel/storage
$ nano .env
While editing Laravel's .env file, enter your domain name for the APP_URL, and database connection info:
Finally just clear the cache...
php artisan cache:clear
$ cd /etc/apache2/sites-available
$ cp 000-default.conf example.com.conf
$ nano /etc/apache2/sites-available/example.com.conf
Edit this file to replace "DocumentRoot /var/www/html" with:
Open up one more file to edit:
Edit the bottom of this new file, to replace these two default lines for the public directory settings (/var/www) with...
Run a few more commands to finish this step:
$ a2dissite 000-default && sudo a2ensite example.com
$ a2enmod rewrite
$ /etc/init.d/apache2 restart
Thanks to the EFF's Certbot, you can now get this step down quickly and easily... for free!! Just run these commands:
$ apt-get install software-properties-common
$ add-apt-repository ppa:certbot/certbot
$ apt-get update
$ apt-get install python-certbot-apache
$ certbot --apache
$ certbot renew
You should now have a functioning server with basic, common security measures installed! From here, you can install SurvLoop, any other Laravel-based projects, or start building your own. You should now see the basic Laravel page when you browse to your IP address or domain name.