Domains, DNS, & Databases
Firmidable Website Training
Where We've Been
The last time!
- Built a page with content
- Styled that page, making the content easier to show hierarchy
- Rebuilt that page as a site in WordPress to make adding pages easier (and do other stuff with with Firmidable plugin)
- Progamatically built the page using PHP
- Built a simple almost-game by manipulating the DOM with JavaScript
What Now?
It's time to go public
What Does Going Public Entail?
- Creating and setting up a public domain
- Set up the hosting for the site
- Create and manage databases
- Set up an FTP user so you can edit the site
- Make a development subdomain
So we're going to do all of this.
What Tech Stack Will We Use
LAMP!
- Linux
- Apache
- MySQL
- 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.
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
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!
- Click on Add New Record
- Click on A Record
- Under "Host," enter @
- Under "Value," enter 64.207.176.71
- Leave the TTL
- Click on ✔
While you're at it, delete the CNAME record for the WWW.
Oh No!
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:
- Add the site to MediaTemple
- Add the site to the hosting backend
- Add a FTP user
- Upload the files
- Creating subdomains
- Creating and updating databases
Add the Site to MediaTemple
- Go to Domains > Add New Domain or Service > Add Domain
- Add Your Domain
- Select "I already Own This Domain"
- Click "Use This Domain"
- Select the only service option
- Click "Continue Order"
Add the Site to the Hosting Backend
- You should have been kicked to the "Services" page
- Click "Admin" > "cPanel Control Panel / WHM Hosting Manager"
- Click the link next to "WHM"
- Log in with the Root user
- Search for "New Account"
- Enter your domain information!
- Save these logins and email them to me after the training!
- Click "Create"
- Close the WHM Hosting Manager
Add a FTP user
This is only your site - typically we'd create logins for everyone!
- Refresh that list of domains.
- Find your domain and click "login"
- If you have to, enter your username and password, but it should automatically log you in!
- Click "FTP Accounts"
- Add your username and password - we use the same across all sites to make sure we can always log in.
- Under "Directory," replace with public_html
- Click Create FTP Account
- Log in using FTP
- 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
- Log in to your user directory in a new FTP tab
- 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!
- When complete (it'll take a minute) - drag them back up to your new FTP!
- This takes a minute, but is easy.
Create Subdomain
- Return to your cPanel home
- Click "Subdomains"
- Under "Subdomain," type dev
- Under "Document root," type public_html/dev
Create Databases
- Return to your cPanel home
- Click "MySQL® Databases"
- Under "Create New Database," type a database name
- Click "Create Database"
- Under "Create New Database," type a z_, then that database name
- Click "Create Database"
- Return to your cPanel home
- Click "phpMyAdmin"
Transfer Your Databases
- Open an incognito tab
- Navigate to cPanel login
- Log in to the old site
- Click "phpMyAdmin"
- Find the database you want to download
- Click "Export
- It's OK to use "Quick" - click "Go"
- Go Back to your new site's phpMyAdmin
- Click on the database you want to upload to
- Click "Import"
- Click "Choose File" and select your database export
- Click "Go"
Update Your Files to Use Your Databases
- Go to wp_options - update the siteurl and home to your wordpress site location
- In Your FTP - visit your wp-config.php
- Update the database name, user, and password to the site user and password
Last Homework Ever
Get your dev site working:
- Upload the files to your
dev directory.
- Upload the database to your z_database.
- Change the wp-config to point to your z_ database.
Extra Credit
USE YOUR NEW DOMAIN