DigitalOcean provides developers cloud services that help to deploy and scale applications that run simultaneously on multiple computers.
Go to namecheap and buy URL. To link to digital ocean go to "manage domains" in namecheap, then click manage to the domain you want to manage. Scroll down to nameservers, click the dropdown and select "custom DNS". Type in "ns1.digitalocean.com, ns2.digitalocean.com, ns3.digitalocean.com" in the 3 inputs, then click the green checkmark to save.
Creating a droplet/server
Change to the team droplets by clicking on your avatar on the top right. To create a new droplet click the green "Create" button next to avatar, and select droplets. Under "Choose an image" click "One-click apps" and select "LAMP on vv.vv". Choose size (1 GB default), and choose a datacenter (San Francisco default). Create an SSH key and add it: run the command
and don't enter a phrase when prompted, then cat the contents of the public key and paste it in the new ssh key input in digital ocean. Change the host name to something simple, and finalize by clicking long green create button.
Connecting droplet to URL
Click the 3 dots on the far right the droplet and click "add a domain". Fill in the domain example.com and submit. When creating new record, type the "@" symbol in hostname. "Will redirect to" must be changed to the url ip, and then submit by pressing "create record". Once that's done, go to the url to verify when a blue shark thing.
Accessing the server (SSH)
Copy IP-address from droplet. Open the terminal and cd into the directory where your ssh keys are located. Type ssh -i key_name root@ip_address. Get your SQL root password run cat /root/.digitalocean_password copy it and run mysql_secure_installation which will prompt you to enter the password. After entering the password a set of prompts will appear:
FTP into server (FILEZILLA)
Install Filezilla. To connect to server you need to import the private ssh key: Open Filezilla settings, and navigate to SFTP (settings -> connection -> FTP -> SFTP). Click Add key file and import private key file, and click Ok. On Filezilla main page file in the inputs as followed:
Connecting to MySQL in the server
Install Sequel PRO. SSH into server. Open Sequel PRO and click the SSH tab, then fill in the following information:
To import SQL:
Composer usage in server
Download the latest composer.phar from https://getcomposer.org/download/ (Scroll down to manual download and click latest version). Once the file is downloaded, remove the .phar extension. Make sure FileZilla is up and connected, and drag the new composer file into /usr/local/bin. Try running composer on the server, if permission denied run chmod 777 /usr/local/bin/composer.
Make sure to run
apt-get update sudo apt-get install php7.0-curl sudo apt install zip unzip php7.0-zip
in the server. Delete vendor folder. Drag and drop folder items into /var/www (html folder should be part of items you drop in). Once it's done, run composer install in the directory where composer.json is located. If you encounter an error in which Classes can't be found make sure your composer.json file has the namespace app\\ connected to "app/" (don't forget the /). If internal error 500, make sure to run
sudo tail /var/log/apache2/error.log
to view error log. If error log shows "invalid command 'RewriteEngine'" as the error run
sudo apt-get install apache2 sudo a2enmod rewrite sudo apache2 restart
Go to https://certbot.eff.org/lets-encrypt/ubuntuxenial-apache and select "Apache" and "Ubuntu version", and follow along.
1364 Field 'display_name' doesn't have a default value (also happens with GROUP_BY)
Cannot insert a value for auto-increment primary key
<table name="table_name" idMethod="native" phpName="TableName" allowPkInsert="true"> ...