Here is How to Upload WordPress Objects to OpenStack Swift, Working Example is With HP Cloud CDN and W3TC Plugin. Necessity is the Mother. What a Linux Server will have difference with a Mac? We have shown how to upload objects to HP Cloud CDN, that is a raw OpenStack Swift from OS X. OpenStack Swift – simple! Why fight with hundreds of crap PHP scripts when there is a perfect tool name Python Swift Client? Most funny, Python Swift Client is more easy to use on GNU/Linux. For our Example, it is an Ubuntu Server! This thing actually trying for the last 3 years. HP has, dedicated developers as employees.
We love OpenShift. It is PaaS, true. But they honor all the peoples who works for free for OpenShift. No freebie, no backlink, not even a Retweet, who will work for free?
Upload WordPress Objects to OpenStack Swift (HP Cloud CDN) : Initial Preparation
Read that guide to upload stuffs to HP Cloud CDN. You need that modified OpenStack RC file. Our modified way is (this is for West) :
We hope, you have a colorful SSH with Nano’s Syntax Highlighting. If you have not, read it later, you can do something within this guide. You are
root, right? If
sudo su is throwing error, read this guide to resolve sudo: unable to resolve host error. You can do that later too. Your
~. You can not see, but there is a
.bashrc file. Open it :
cd ~ && nano .bashrc
uncomment the line
unset color_prompt force_color_prompt, that will give you some color on SSH. Go to the end of the file and add your modified real stuffs copied from above block, which is actually part of OpenStack RC file. Load the environment :
First part done.
Upload WordPress Objects to OpenStack Swift (HP Cloud CDN) : Step 2
Run this command :
apt-get install python-swiftclient
It will say many things, you need not to read, accept with
Y. After installation, run this command to test :
It will return a thing which means, you have done the right :
No handlers could be found for logger "keystoneclient.httpclient"
You can list your containers :
No handlers could be found for logger "keystoneclient.httpclient" is not a problematic error. It looks bad, but you’ll have no issue. Suppose you are using nginx and your WordPress is located at
/usr/share/nginx/html, then cd to that place :
Or may be :
wget this on your local computer and read :
Upload all the files you want. Actually, on nginx, you need a simple directive to auto replace the static files’ URLs. That is exactly done by W3TC. You can enable CDN with Rackspace Cloud Files option and use the HP Cloud or whatever OpenStack Swift
domain name. W3TC will provoke you to use password, username etc. Do not use your real HP Cloud credentials. Rackspace guys will able to see your password! NSA can also see, that is different thing. But the needed change either will be done automatically by W3TC or it will prompt. Together, PHP and Nginx block does the thing. Simple.
Yeah, as there is no filter, all files will get uploaded. 35MB extra upload. You can create a small bash script to do avoid typing commands and set cron. Instead of PHP, you’ll use command line. WordPress plugin is for those who use Shared Hosting.
No password prompt, no fuss. Very fast upload. You are not disturbing weak PHP, so no chance of WordPress white page. Run this command (create a container named
tcw-january-w3tc from Dashboard, set TTL, Publish it publicly as CDN beforehand) :
swift upload tcw-january-w3tc /usr/share/nginx/html
You’ll see, how nicely stuffs are getting uploaded. If you want only to upload the updated stuffs, then run :
swift upload -c tcw-january-w3tc /usr/share/nginx/html
Thats what you need to create a script with. Instead of you, cron will run it. Virtual directory will be created in this way :
# fake url
You can not download from CDN :
It is file ownership and permission preventing it to get uploaded! Thats the fun of *nix. It is basically, file level backup which Rackspace sells at higher cost. If you modify the method, you can use more powerfully. By the way, it is Apache2 server,
.htacess does not work. You
can block need to delete the sensitive PHP, HTML etc. files on web server.