Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dotherightthing/dfc3f8eb4384ee3f5295f1d64ec2883a to your computer and use it in GitHub Desktop.
Save dotherightthing/dfc3f8eb4384ee3f5295f1d64ec2883a to your computer and use it in GitHub Desktop.
[Setting up a staging site on Sitehost shared hosting] #hosting #wordpress

Setting up a staging site on Sitehost shared hosting

Created: 2017.05.30

A simple process, but one which often fails. Here are the definitive steps.

Steps

  1. Select Account: dotherightthing.co.nz
  2. Websites > Add Website:
  3. Hostname: sitename.dotherightthing.co.nz
  4. IPv4 Address: 120.138.19.15 (php55.air.sitehost.co.nz)
  5. DNS Zones > Add
  6. Domain name: sitename.dotherightthing.co.nz
  7. Template name: SiteHost Shared Hosting - PHP 5.5 / MySQL 5.6
  8. Websites > Shared Hosting > Protected Folders
  9. Add folder: http://sitename.dotherightthing.co.nz + / 2: Set username and password (watch out for this wiping out WordPress's rewrites .htaccess file)
  10. Record the username and password for future reference
  11. MySQL Databases >Shared Hosting - PHP 5.5 / MySQL 5.6
  12. TODO

Troubleshooting

Upon loading sitename.dotherightthing.co.nz in Chrome:

This site can’t be reached sitename.dotherightthing.co.nz’s server DNS address could not be found.

Pinging the server

This can quickly highlight DNS issues.

Working:

$ ping sitename.dotherightthing.co.nz
PING sitename.dotherightthing.co.nz (120.138.19.15): 56 data bytes
64 bytes from 120.138.19.15: icmp_seq=0 ttl=58 time=27.322 ms
64 bytes from 120.138.19.15: icmp_seq=1 ttl=58 time=23.566 ms
64 bytes from 120.138.19.15: icmp_seq=2 ttl=58 time=24.636 ms

Not working:

$ ping sitename.dotherightthing.co.nz
ping: cannot resolve sitename.dotherightthing.co.nz: Unknown host

DNS propagation

The DNS needs to propagate globally.

The current state of propagation can be viewed on the cool DNS Propagation Checker map.

Time to live (TTL)

The TTL determines how long this propagation will take.

SiteHost support:

As the SOA record for the domain "dotherightthing.co.nz" shows a TTL of 3600 it would take at least one hour for the records to propagate.

You can check your TTL settings in the advanced zone settings: http://kb.sitehost.co.nz/faq-domains/dns-not-working

Wikipedia:

Time to live (TTL) or hop limit is a mechanism that limits the lifespan or lifetime of data in a computer or network

Shorter TTLs can cause heavier loads on an authoritative nameserver, but can be useful when changing the address of critical services like Web servers or MX records, and therefore are often lowered by the DNS administrator prior to a service being moved, in order to minimize disruptions.

The units used are seconds. An older common TTL value for DNS was 86400 seconds, which is 24 hours. A TTL value of 86400 would mean that, if a DNS record was changed on the authoritative nameserver, DNS servers around the world could still be showing the old value from their cache for up to 24 hours after the change.

Fixes

Check that the server is available on the sub account

When using a sub-account, sometimes you'll have to add/remove services access to the account. In this case, PHP 5.5 / MySQL 5.6 was not enabled for dotherightthing. To do that, you can check the 'Change Sub-Account Services & Servers' at http://kb.sitehost.co.nz/cp-my-account/subaccounts (SiteHost Support, March 2017)

Change Sub-Account Services & Servers

Start at the parent account.

  1. In the My Account module click "Sub Accounts"
  2. Click on the name of the Sub Account that you want to update services and servers for.
  3. Click "Servers and Services". See Figure 2.
  4. Click the "Add" button.
  5. You will be shown a list of servers that you have access to and the services running on those servers. Select one of the servers and the services that you want to add access for the Sub Account.
  6. Click "Add services"

As of May 2017, this shows:

There are no more servers available for you to add. If you would like to arrange access to SiteHost Shared Servers, please contact [email protected]

Clear the browser's DNS cache (didn't work)

From https://superuser.com/questions/203674/how-to-clear-flush-the-dns-cache-in-google-chrome:

Navigate to chrome://net-internals/#dns and click "Clear Host Cache" Navigate to chrome://net-internals/#sockets abd click "Flush Socket Pools"

Clear the machine's DNS cache

From https://superuser.com/questions/203674/how-to-clear-flush-the-dns-cache-in-google-chrome:

OS X 10.10+ (Yosemite): sudo discoveryutil mdnsflushcache

This didn't work on MacOS Sierra:

discoveryutil: command not found

Clear the router's DNS cache (worked)

From https://superuser.com/questions/203674/how-to-clear-flush-the-dns-cache-in-google-chrome:

Your router may be caching the DNS as well (restart it or read the manual)

Use a hosts file

A hosts file allows you to locally overwrite global DNS settings (http://kb.sitehost.co.nz/faq-websites/hosts-file):

120.138.19.15 sitename.dotherightthing.co.nz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment