README gig_freelancer_for_wp
These are instructions for setting up your personal WordPress blog, so you can hire a gig freelancer to pull out a thorn.
These instructions assume your personal blog is on a low-cost Shared Hosting server. For these instructions you will require privledged access to your remote server:
- SSH/Bash access to your shared server, noted below as
$
- cPanel, noted below as
cPanel
- WordPress-Admin, noted below as
WP
This assumes that if your live WordPress directory on your remote server looked like this:
+ /home/mydomain/public_html/
+ fooproject/
- dev.fooproject/
- live.fooproject/
Then your WordPress directory will look something like this when finished:
+ /home/mydomain/public_html/
+ fooproject/
- dev.fooproject/
- freelancer.fooproject/
- git.fooproject/
- live.fooproject/
-
Create bare git central repo: Begin in the project directory on your webserver. This is the parent directory of your WordPress install directory:
$ cd /home/mydomain/public_html/fooproject/ $ git init --bare fooproject.git
NOTE. This is how I like to setup directories on my webserver. Your structure will likely be different. The important feature is to locate the central repository in a directory where the freelancer does not have permissions to access via ftp.
Change directory to the production (or testing/dev) directory:
$ cd /home/mydomain/public_html/fooproject/live.fooproject/
-
Create
.gitignore
file for the current installation. There are plenty of examples on the internet. At this point, I'm concerned only with sensitive information# Ignore configuration files that may contain sensitive information. wp-config.php
-
Create git project repo OR update current git repo I originally had a git repo with
live
anddev
versions. After I stopped developing for a time, I went through my subdomains and removed the central repos anddev
subdomains. For this project, I needed to recreate all of the git repos. -
Create new (OR, Update existing project repo):
$ git init $ git add * $ git commit .
-
Updating Remote name and url Update the project repo to point to the central repo:
$ git remote add origin path/to/your/central/git/repo
-
Confirm change:
$ git remote -v
-
Rename origin to project name: (I don't think this is necessary, but it's something that I've been doing)
$ git remote rename origin fooproject
-
Push to the Central Repository; Complete initial git repo setup:
$ git push fooproject master
Now we have two copies of the exisiting website. Next, we git pull from the central report to our new freelancer directory.
-
Create new folder in project directory:
$ mkdir freelancer.fooproject
-
Change directory to the
freelancer.fooproject
directory:$ cd /home/mydomain/public_html/fooproject/freelancer.fooproject $ git clone --branch master fooproject.git freelancer.fooproject
Now there are three copies of the exisiting website. This new subdomain we will share with the freelancer.
cPanel [Home] > Domains > Subdomains
url= freelancer.fooproject.mydomain.com
points= /home/public_html/fooproject/freelancer.fooproject
-
Copy the existing WordPress database:
cPanel [Home] > Databases > phpMyAdmin - Select database in sidebar: `fooproject` - In focus area find Operations [tab] --> copy database to - Enter new database's name= `fooproject_dev`
-
Edit the
options
table in the new database copy. Using the subdomain trick, phpMyAdmin will group the new database in the database names tree. -
Open the tree to see the new database's tables.
- Select database table:
fooproject_dev
> fooproject_options
-
Edit table values:
siteurl = freelancer.fooproject.mydomain.com home = freelancer.fooproject.mydomain.com blogname = [existing title] -- freelancer
Warning. Your live WordPress directory has the file wp-config.php
. This file reveals the database password. Avoid exposing your live passwords.
cPanel [Home] > Databases > MySQL Databases
-
Create new user:
user = fooproject_freelancer password = [same as database] priveledges, all
-
Add user as Privileged User of new database:
- Find on page --> 'Add a User to a Database'
- You database will only need this one Privileged User
-
Copy
wp-config.php
from live/dev site's directory to freelancer WordPress directory. -
Edit and change the values for the following parameters to match new database user (#4.1):
DB_NAME DB_USER DB_PASSWORD
FTP is helpful when you're developing. Be kind to your freelancer and give them FTP.
cPanel [Home] > Files > FTP Accounts
user=freelancer
password=[same as database]
quota = 500MB (tried 5MB, but this was used up just creating the user!)
With all this copying and stuff, it's best to update the projects permissions. It's usually the first cause of 500 server errors.
$ cd /home/mydomain/public_html/fooproject/freelancer.fooproject
$ find . -type d -exec chmod 755 {} \;
$ find . -type f -exec chmod 644 {} \;
- Do the same for central repository.
Your current WordPress user is still the same as on the original live WordPress site. This is very dangerous to your site.
-
Login as admin to edit:
http://freelancer.fooproject.mydomain.com/wp-admin/
-
Create new WP user, "freelancer".
-
Add new user:
WP [dashboard] > Users > All Users --> Add New user = freelancer password = [same as database]
-
Grant Admin privledges:
WP [dashboard] > Users > All Users --> Change role to... - Check new user name from the list - Select 'Administrator' from `Change role to...` pulldown menu
-
Change your admin user's password also !! (I also updated my email address from private to business)
cPanel [Home] > Advanced > Cache Settings
Disable cache for freelancer.fooproject.mydomain.com
+++