Tag Archives: wordpress

Moving wordpress from shared host to aws ec2

I did an experiment recently trying to move my wordpress website from a shared hosting site to Amazon aws ec2 micro instance (t1). The migration was mostly successful, I did not make the move eventually due to some technical and non-technical reasons. Nonetheless, I would like to share some of the lesson I learned from this process. I followed this blog post form smashmagazine as a blueprint for “moving wordpress”. Note I already have ubuntu installed on ec2, and has setup keys for my laptop.

1) Setup wordpress on new host. This is the link I followed to setup wordpress on ubuntu on my aws ec2. Another useful article is here.

2) Upload files: I used FileZilla (SFTP) for uploading the files. Here is the link regarding setup keys. Note the file permission is also very important to make wordpress work, which is especially important when moving the sites. More on this later.

3) File permission, one thing I noticed quickly is I don’t have any writing privilege after moving, e.g., update plug-ins etc. Did google quite a bit, and tries to change the file permissions using FileZilla. No luck. Eventually I read this from wordpress official doc. Quote:…(a) file ownership: all of your WordPress files must be owned by the user under which your web server executes. In other words, the owner of your WordPress files must match the user under which your web server executes. The web server user (e.g., “apache”, “web”, “www”, “nobody”, etc.) is not necessarily the owner of your WordPress files…

I did “ps -ef|grep httpd” at my ubuntu server, and find the user for apache web server (not “root”). And changed the file owner to this user (via “chown” command).

4) MySQL server crash: I found this happens quite often (as often as once every 3 days). Turns out to be a memory problem for the t1 micro instance and apache web server and mysql fights for the memory, eventually mysql lost. The solution I found is add virtual memory to the system, and reduce the memory requirement for mysql in config file. Eventually I was able to have mysql run as long as 13 days without shutting down. Not ideal, but still meaningful improvement (13 days uptime vs 3). Another idea, people talked about is use a lightweight http server such as this one.

5) MySQL database migration. Found out for large database, php export will not complete, and will end up with some junk html in the database file (.sql), it will fail during import. The workaround is do the export and import in the mysql command line. But I still have one problem with database, it appears the Chinese character got lost during this process. This problem along with the mysql server problem mentioned above, and the relative higher cost of AWS compared to shared host, made me decide to not switch at this time.

Other links:
Setup php/mysql, and phpMyAdmin.

Craig Emerson has an up-to-date article on this topic WordPress CloudFront CDN Setup Using W3 Total Cache.

Software updates

WordPress 3.1.1
Finally I got hands around my blog (this one stlplace) and did the WordPress upgrade. I put off the upgrade in the past primarily due to my laziness: there is no automatic update due to I was running on WP 2.0.2. The upgrade itself is not too bad, I followed those two articles on Backup database and Run manual update. I used phpMyAdmin for the WP database backup. For the WP upgrade the only tricky part for me is:

“…Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files)…”

I know “directory overwriting” generally works on Windows system, but we are talking about UNIX (Linux to be precise). The command I used goes like this (in the blog root directory):

cp -r -u new_wp-content_dir .
(here -r means recursive for directories; -u means update)
I believe it did the trick, as I can run upgrade database afterwards. After that I enabled the necessary plugins. The only plugin stopped working is the ultimate warrior tags. The rest are fine.

Btw, I also added WPtouch plugin so that this blog works better on iPhone.

Xcode 3.2.6
I found my old Xcode 3.2.2 can not handle block as it’s necessary to run Ray’s RSS reader example. Download the software from Apple, install, and found this “Base SDK missing” in the new Xcode. Did some google, the trick is to “use latest SDK” in the “project => build” setting. I noticed we can also build “older” targets by changing the target in “deployment target”. Obviously there is a limit as to how far we can go back (I have not checked that yet).

Btw, I found the iPhone 4 simulator looks cooler than iPhone 3 simulator :-)

Added tags

I added the “tags” for this blog. There are two places you can see the “tags”: under the time in each post; the right side bar (under “tags”). So what is “tag” exactly? Using non-technical terms, tags is like “key words”. “Tag” helps organize and search the blogs.

To use it, you just simply click on the “tag”, and it will show the related articles which contains that “tag”. The “tags” cloud map in the right side bar ranks the popularity of each tag by the size of “tag”. The larger the font, the more popular it is.  

If you are really curious about how to make this work in WordPress blog, here is the link for “Ultimate Tag Warrior plug-in”.

Believe it or not, although “Google search” is so good, in lots of cases the “tags” created by human beings are much better in organizing and searching blogs. I am also including the definitions for “tags” from the blog search engine Technorati here. 

Get started 使用说明

(Updated May 2011) “古人云,人不自信谁人信之.” Others won’t believe in you unless you believe yourself. –Chinese proverb

Hello, world :-) I am not another expert. I am an ordinary guy who believes: by lifetime learning, hard and independent work and discipline, little guys can achieve their dreams, too.

I grew up in China. Currently I am working on iOS (iPhone/iPad) app development. Here I’m also blogging about iOS app/software development, business, personal finance, and other fun stuffs in life. You can leave comment here or Email me: if you wish to remain private.

Tip: you can always hit “home” or type www.stlplace.com to get back to the home page.

Search: please refer to the “search this site” page, as this is a bit complicated.

Related post: I added “related post” functions to this blog today. Basically it will show “related posts” at the end of each article if you go to each post (by clicking on the title). Hopefully this will make navigation of this blog a bit easier. Now we have search on the side bar (search by word, search by Google), and this related post thing. I also added “save to del.icio.us” button at the bottom of each post.

Revisions
(5-28-2011) Converted Ultimate Tag Warriror to WordPress tag, by importing and enable tag cloud in side bar. More information on U can be read here.

(April, 2011) Upgrade to WordPress 3.1.2, the only thing not working is Ultimate Tag Warrior.

(12-12-2009) Added my twitter widget. The Google Conversation Elements were removed earlier due to lack of interest. Note “Share This” Button at the end of each post has the buttons for Twitter, Facebook etc. Enjoy!

Added Google Conversation Elements.(May 30, 2009): this is to facilitate interesting and intelligent discussions on things. Enjoy!

Used compact archive (May 30, 2009): link to plugin.

Added “Share This” button (May 22, 2009): this is for bookmark and sharing with your friends. Try it out :-)

Switch to a three column theme (simplicity), this allows for more room for side bars. (Dec 2007)

Tanslation: I added a language tool at the right side bar. You can click on the flag to get an instant translation of this blog. This is not perfect and sometimes it does not work because of server problem. But at least you can get a glimpse of what I’m talking about. (May 20, 2007)

My view on stocks: Information is provided ‘as is’ and solely for informational purposes, not for trading purposes or advice. (Mar 15, 2007)

Pictures: some of the pictures (those hosted on flickr and yupoo) are clickable. You can see a bigger picture if you click on it. (Mar 12, 2007)

Subscription: besides point your web browser to stlplace.com, you can also use “Add to My Yahoo”, subscribe to “feedburner” or “newsgator” to get the latest post. Pick your favorite way to get the blog: type in web address and check if there is anything new (the so called “pull” method); or the RSS subscription (so called “push” method, the new post is pushed to your web page automatically). (sometime in 2006)

Dec 2005, initial release.

(Original Dec 2005) Hello, world. I am not another stock expert. I am an ordinary guy who believes that: by learning and disciplined investing little guy can beat many “experts”.

At STLPlace, we believe in independent research and value investing. We don’t blindly chase hot stocks, we don’t follow Jim Cramer, and we don’t catch falling knives…

I grew up in China and have been in the US since Fall 1997. Here I’m blogging about business, finance, stocks, other fun stuffs in the US and China.

This is a place I’m sharing my thoughts. Please don’t take this as a stock tip and run with it. One selfish reason for this blog is to organize my thoughts and actions on stocks, and be a better investor along the way. Hopefully you can also benefit from this process: the result matters, but more importantly is how we get there, so that we can repeat the success.

Any comments, please send email to: