Using Qiniu Cloud as an Image Bed: Step‑by‑Step Guide with MPic and CDN Configuration
This guide explains how to set up Qiniu Cloud object storage as an image‑hosting service, configure a CDN domain with CNAME records, bind a custom domain, and use the MPic tool to automatically upload images for use in Markdown editors.
This article provides a complete tutorial for turning Qiniu Cloud into an image‑hosting service that can be used directly in Markdown documents.
1. Download the MPic image‑hosting tool
Download MPic from http://mpic.lzhaofu.cn .
2. Apply for a Qiniu Cloud Kodo (object storage) account
Visit https://portal.qiniu.com/kodo to create a bucket.
3. Purchase a cloud server
Buy a minimal‑configuration server on Tencent Cloud, which provides a public IP address.
4. Register a domain name
Purchase a domain (e.g., jayh.club ) via Tencent Cloud at https://buy.cloud.tencent.com/domain?from=console .
5. Bind the domain to Qiniu CDN
Create an accelerated domain in Qiniu and bind it to your custom domain (e.g., cdn.jayh.club ).
6. Configure CNAME record
Set a CNAME record that points your sub‑domain (e.g., cdn ) to the CNAME value provided by Qiniu (e.g., cdn-example-com.qiniudns.com ).
FAQ
Why is a CNAME record needed for CDN?
After creating an accelerated domain, Qiniu assigns a CNAME domain; the CNAME record directs traffic to Qiniu’s CDN, which then routes requests to the optimal edge node.
What is the relationship between CNAME and A records?
Both are DNS record types. An A record maps directly to an IP address, while a CNAME maps to another domain name, which is then resolved to an IP.
Configuration steps
Copy the CNAME value from Qiniu and add it in the DNS management console of your domain registrar.
Field
Value
Host
cdn
Record Type
CNAME
Record Value
Qiniu‑provided CNAME
7. Set up upload credentials
Obtain AccessKey and SecretKey from the Qiniu console ( https://portal.qiniu.com/user/key ) and use the domain http://cdn.jayh.club for image URLs.
8. Use MPic for automatic uploading
1) Configure copy‑and‑paste auto‑upload
After copying an image, MPic automatically uploads it to Qiniu.
2) View uploaded images
Visit http://mpic.lzhaofu.cn/home/History to see the image list.
3) Copy the image URL
Paste the copied Markdown link into your editor (e.g., Typora) to see the image preview.
Alternative: Alibaba Cloud OSS as object storage
Download the Alibaba‑cloud version of MPic from http://mpic.lzhaofu.cn/ .
Access the OSS console at https://oss.console.aliyun.com/bucket .
Configure MPic to use your Alibaba Cloud OSS bucket.
Follow similar steps to bind a custom domain and set up CNAME records for Alibaba Cloud CDN.
Wukong Talks Architecture
Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.