Linux

Migrating a z-blog

For a long time, my personal blog has been hosted on an Alibaba Cloud VPS, the lowest-tier configuration (1 core, 512MB RAM, 20GB disk, 1Mbps bandwidth, one fix

For a long time, my personal blog has been hosted on an Alibaba Cloud VPS, the lowest-tier configuration (1 core, 512MB RAM, 20GB disk, 1Mbps bandwidth, one fixed IP), which comes to 49.5 RMB per month. At first, I figured it was like topping up some "Super VIP" membership at a chat company — no chat features, sure, but at least I could set up the pages however I wanted, "however" being the key word. But the trouble is: as an IT professional (and I say that loosely — really I just know how to fix computers, but the title does carry a certain cachet), I still have to pay monthly rent for a server, and to make it worse, it's Alibaba Cloud, a domestic server. I remember registering my first domain name — all I wanted was a little symbol of myself somewhere on the internet. Back then I thought, once I discovered Alibaba Cloud, setting up a personal site would be a breeze. I didn't realize I'd also need to file for ICP备案 (recordal), and after much back-and-forth, that finally got sorted out. Recently, though, I registered a new domain name and wanted to set up stealth URL forwarding to the old one to save some hassle. Of course, the moment you try to avoid hassle, hassle comes for you with a vengeance. With an ICP-unfiled Wanwang domain, after forwarding it shows a test page — something about not being able to access it per "certain bureau, certain document" regulations. Considering the recent waves of internet censorship, on the principle that "fewer issues is better than more," I went ahead and filed for ICP备案 for the new domain too. Then, with work getting busy, I forgot all about it. When I finally remembered, I happened to have a spare computer on hand, so I put it to work as a server. As luck would have it, my router also supported DDNS, and so a battle was joined: domain registrar transfer, website hosting transfer, the whole thing. Right now, the site is running fine — and since there aren't many visitors, a 4Mbps broadband connection is doing the job. Below is a summary of the issues I ran into during the process.

  1. A domain registered with Wanwang can be transferred to name.com, where $8.25 will extend its usage by one year; enter an online coupon code and you also get one year of privacy protection;
  2. Domains registered with Wanwang cannot use stealth URL forwarding to domains that lack ICP备案, but name.com can;
  3. To transfer a Wanwang-registered domain to name.com, you first need to apply for the transfer in the Wanwang domain management console and receive an "author code" in your email; then register as a name.com member, find "Domain Transfers," fill in the required information, and wait about 4–5 days;
  4. Overseas domain registrars and hosting do not require ICP备案 — domains under name.com can forward to anywhere;
  5. To migrate a Z-Blog site, you only need to move the directory under "/var/www/" and import/export the database (Debian Linux 7.3);
  6. Common database commands include: connecting to MySQL: mysql -u root -p; creating a database: create database ; switching to a database: use ; exporting a database: mysqldump -u root -p > + a memorable filename; importing a database: mysqldump -u root -p < ;
  7. When importing the database, I found using the above commands left the imported database with no tables at all. So I connected to the database in question and ran the command "source " — after that, everything finally worked properly;
  8. The web pages displayed correctly, but I couldn't log in to the admin panel. I edited the file "/var/www/zb_users/c_option.php" and changed a few variables — "ZC_BLOG_HOST", "ZC_MYSQL_NAME", and the like — and everything was completely normal again.
  9. Why do I say "...and the like"? Because after I re-copied the file and overwrote it without making any further changes, the site just worked. Previously, modifying these variables had actually caused the site to fail to connect to the database — amazing!
  10. To wrap it up: Peanut Shell (花生壳) is great to use, even though you only get a free subdomain; installing PHP + Apache2 + MySQL on Linux also requires installing "php5-mysql" and "libapache2-mod-php5" as extras; for database migration, you can apparently just copy the folders under "/var/lib/mysql" directly — I tried it once and it worked, because after all, in Linux, everything is a file.
N
norvyn

独立 iOS 开发者,写字的人。在一座有海的城市,慢慢地做一些小而确定的东西。An independent iOS developer and writer — slowly making small, certain things in a city by the sea.

评论Comments

加载中…Loading…

留下评论Leave a comment