Keeping WordPress up to date
I originally installed WordPress using Subversion. This provides a really easy way for me to update WordPress:
svn switch http://core.svn.wordpress.org/tags/3.4.1
3.4.1 with the latest version number. Then I visit the admin panel of the blog and it will redirects me to perform any necessary database upgrades.
.htaccess to prevent access to the
# Prevent access to .svn directory # From http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion RewriteEngine On RewriteRule ^(.*/)?\.svn/ - [F,L] ErrorDocument 403 "Access Forbidden"
I’ve learned that content can be categorized into static content and dynamic content. There is an Apache module,
mod_deflate, that can compress both types of content seamlessly. It only requires a configuration change in
.htaccess, and no changes will need to be made to the application. However, it is inefficient because it recompresses the same content every time someone requests it. For this reason, my web host does not support
mod_deflate. Instead, they recommend different tactics for each type of content.
On my blog, an example of dynamic content is the home page,
http://www.rratliff.com/. This test or this test can test whether the home page is compressed. At time of writing, I have not found a good way to compress dynamic content.
On my blog, there are several static content files that are typically requested. For example, the CSS and JS files that WordPress includes in every page. Google Page Speed Insights is the a tool that tests compression of every resource needed for loading my blog’s home page, both the dynamic and static pages. I’m looking for a reliable way to compress the static content files that Google Page Speed Insights finds.
Deploying static content
I now have two sections of static content on my website, my Post Voting App and my Portfolio. I’ve adopted a simple solution to keep these sections up to date. Each section is maintained in a github repository. I have a matching repository on my own computer where I make changes, commit, and then push to the github repository. Then, to update the content on my website, I SSH to the host, cd to the directory, and do a
I reuse the
.htaccess code above in order to prevent access to the
.git subdirectory. See the
.htaccess file for an example.
I created two scripts to backup the files and the database in my NearlyFreeSpeech site. The scripts aren’t fancy, they just contain one command each.
For the database, I created a non-privileged backup user who has permissions necessary to do a mysqldump on all the tables in my database. Here’s the gist of it. (It should be all one line. Lines wrapped for display purposes.)
ssh user@host mysqldump --user=nonprivilegeduser --password=password --host=mysql_host --all-databases | gzip > backup-file-name-$(date +%Y%m%d).sql.gz
Just change the underlined parts. The
$(date) thing creates a filename like this:
For the files, I use
rsync with the options