Domains, DNS, & Databases

Firmidable Website Training

Where We've Been

The last time!

  1. Built a page with content
  2. Styled that page, making the content easier to show hierarchy
  3. Rebuilt that page as a site in WordPress to make adding pages easier (and do other stuff with with Firmidable plugin)
  4. Progamatically built the page using PHP
  5. Built a simple almost-game by manipulating the DOM with JavaScript

What Now?

It's time to go public

What Does Going Public Entail?

  1. Creating and setting up a public domain
  2. Set up the hosting for the site
  3. Create and manage databases
  4. Set up an FTP user so you can edit the site
  5. Make a development subdomain

So we're going to do all of this.

What Tech Stack Will We Use

LAMP!

  1. Linux
  2. Apache
  3. MySQL
  4. PHP

There are other stacks, and they work a little differently (e.g. Windows/IIS), but they do the same things just with different code.

DNS

It's cutesy but explains the whole process: How DNS Works

DNS points the browser in the right direction, pulling up the right server.

What's A Domain?

A domain is just a vanity number for an IP address.

"firmidable.com" just means 64.207.176.71/[filepath]/firmidable.com

If it's not pointed to anything, you get a DNS error.

Yesterday’s Emails

Access to a domain!

Log In Now!

Namecheap Login

Your Dashboard

WARNING: Domain & Hosting companies are there to sell to you. Stay focused on your task.

Click on Manage next to your domain name.

Your Dashboard: Manage DNS

NameCheap Dashboard - click on the highlighted delete
Click on the highlighted "Delete" button. WWW is a subdomain of your new domain, and you just don't need it!

After that, Click on Advanced DNS

DNS Records

A
Address: points a hostname to an IP address
CNAME
Canonical Name: points a hostname to another hostname
MX
Mail Exchange: points mail to a mail server
SRV
Service: controls other services, often used with apps
TXT
Text: notes that control other records, like SPF records for spam-checking

Full list of them: Wikipedia List of DNS Records.

Our DNS Records

We know the IP address that we want to point our domain to!

  1. Click on Add New Record
  2. Click on A Record
  3. Under "Host," enter @
  4. Under "Value," enter 64.207.176.71
  5. Leave the TTL
  6. Click on

While you're at it, delete the CNAME record for the WWW.

Oh No!

DNS error page
We're pointing to a server that doesn't know what to do with our domain.

Setting Up A Domain for Firmidable

Go to the howto site, search "Go Live"

Our process today:

  1. Add the site to MediaTemple
  2. Add the site to the hosting backend
  3. Add a FTP user
  4. Upload the files
  5. Creating subdomains
  6. Creating and updating databases

Add the Site to MediaTemple

  1. Go to Domains > Add New Domain or Service > Add Domain
  2. Add Your Domain
  3. Select "I already Own This Domain"
  4. Click "Use This Domain"
  5. Select the only service option
  6. Click "Continue Order"

Add the Site to the Hosting Backend

  1. You should have been kicked to the "Services" page
  2. Click "Admin" > "cPanel Control Panel / WHM Hosting Manager"
  3. Click the link next to "WHM"
  4. Log in with the Root user
  5. Search for "New Account"
  6. Enter your domain information!
  7. Save these logins and email them to me after the training!
  8. Click "Create"
  9. Close the WHM Hosting Manager

Add a FTP user

This is only your site - typically we'd create logins for everyone!

  1. Refresh that list of domains.
  2. Find your domain and click "login"
  3. If you have to, enter your username and password, but it should automatically log you in!
  4. Click "FTP Accounts"
  5. Add your username and password - we use the same across all sites to make sure we can always log in.
  6. Under "Directory," replace with public_html
  7. Click Create FTP Account
  8. Log in using FTP
  9. Create an index.html file to make sure the domain is working

The Challenge of DNS Propagation

And… we wait.

It shouldn't but can take up to 24 hours.

Try using a proxy or VPN to visit the site - they might not have it cached.

Either way, we can keep working while it propagates.

Upload your files

  1. Log in to your user directory in a new FTP tab
  2. Download all of your files - just drag them to a folder on your computer. I'd suggest making a new folder for this purpose to not lose anything!
  3. When complete (it'll take a minute) - drag them back up to your new FTP!
  4. This takes a minute, but is easy.

Create Subdomain

  1. Return to your cPanel home
  2. Click "Subdomains"
  3. Under "Subdomain," type dev
  4. Under "Document root," type public_html/dev

Create Databases

  1. Return to your cPanel home
  2. Click "MySQL® Databases"
  3. Under "Create New Database," type a database name
  4. Click "Create Database"
  5. Under "Create New Database," type a z_, then that database name
  6. Click "Create Database"
  7. Return to your cPanel home
  8. Click "phpMyAdmin"

Transfer Your Databases

  1. Open an incognito tab
  2. Navigate to cPanel login
  3. Log in to the old site
  4. Click "phpMyAdmin"
  5. Find the database you want to download
  6. Click "Export
  7. It's OK to use "Quick" - click "Go"
  8. Go Back to your new site's phpMyAdmin
  9. Click on the database you want to upload to
  10. Click "Import"
  11. Click "Choose File" and select your database export
  12. Click "Go"

Update Your Files to Use Your Databases

  1. Go to wp_options - update the siteurl and home to your wordpress site location
  2. In Your FTP - visit your wp-config.php
  3. Update the database name, user, and password to the site user and password

Last Homework Ever

Get your dev site working:

Extra Credit

USE YOUR NEW DOMAIN