Home / Site Wizard / Self-hosted Image Hosting / Object Storage

Self-hosted Image Hosting / Object Storage

Object storage plus direct-link management: your images, your rules, and a natural affiliate angle.

🖼️ Scenario ⏱ 1.5 hours 5 steps Difficulty 0 / 5 steps done
■ Full text · Static content

Self-hosted Image Hosting / Object Storage: the complete 5-step walkthrough

This is the full static walkthrough (scripts and checklists included), generated by scripts/seo-prerender.js from data/en/steps.json so that search engines and visitors with JavaScript disabled can read it. The interactive wizard above has exactly the same content.

  1. Step 1 · Create the bucket + basic settings

    Pick a region, public-read / private-write, standard storage

    An image host is really just a bucket whose files you can link to directly. In China the usual choices are Tencent Cloud COS or Alibaba Cloud OSS; elsewhere any S3-compatible storage or Cloudflare R2 works the same way.

    Bucket checklist:

    1. Pick a region close to your readers — cross-region access is slower and costs more.
    2. Permissions: public read, private write. Others can view your images, but can't push files into your bucket.
    3. Skip "global acceleration" unless you genuinely have overseas readers — it's a paid extra.
    4. Storage class: standard. Infrequent-access and archive tiers are for cold data; image hosting is hot data.

    Once the bucket exists you get a domain like https://xxx-123456.cos.ap-guangzhou.myqcloud.com — that's the prefix for your direct image links.

    Checklist
    • Bucket created with public-read / private-write
    • You can build a test image URL and open it in a browser
  2. Step 2 · Custom domain + CDN

    Your own domain, HTTPS, CDN origin

    The vendor's default .myqcloud.com domain works, but with two problems: it's long and branded, and without CDN the speed varies wildly between regions.

    Binding a domain:

    1. In the COS console, add your image domain (for example img.example.com) as a custom origin domain, then CNAME it to the CDN domain the vendor gives you.
    2. Turn on HTTPS (the vendor's free certificate or your own), otherwise browsers flag the site as "not secure".

    Enabling CDN: add the bucket as the origin in the acceleration settings. CDN caches your images on edge nodes, so readers fetch from nearby — faster, and it cuts your bucket's outbound traffic bill.

    Note: custom domains in mainland China normally require an ICP filing; a domain without one can't be used as your image domain.

    Checklist
    • Images load over HTTPS on your custom domain
    • CDN status is enabled
    • Speed is fine from different regions
  3. Step 3 · Hotlink protection + cost control

    Referer rules + traffic and size alarms + lifecycle rules

    Two things kill an image host: someone hotlinking your images (burning your bandwidth) and a bill that runs away.

    Hotlink protection (Referer check): configure it in the COS console to allow only your own domains (optionally blank referrers too). Any other site embedding your images gets a 403, so nobody can paste your images on their site and drain your traffic.

    Cost monitoring:

    • Set alarm thresholds for storage size and traffic, with email or chat notifications.
    • Use lifecycle rules to auto-delete temporary images older than N days.
    • Check the bill regularly: cost = storage + traffic + requests, and outbound traffic is usually the biggest line — CDN removes most of it.

    A small image host costs a few dollars a month, but you don't want to discover the bill after it's been abused. Turn on hotlink protection and alarms from day one.

    Checklist
    • A non-whitelisted domain gets 403 on your images
    • Traffic and size alarms are configured
    • You can view the bill
  4. Step 4 · Upload toolchain (drag, get a link)

    COSCLI / ossutil on the CLI, or PicGo on the desktop

    You can't open the web console for every upload — you need something fast.

    Pick one:

    1. COSCLI / ossutil (CLI): the official command-line tools, good for batches. With keys configured:

    coscli cp ./photo.jpg cos://your-bucket/2026/photo.jpg

    1. PicGo (desktop, highly recommended): drag an image in and it uploads, then copies the direct link to your clipboard — perfect when writing. Supports COS, OSS, Qiniu and many others.
    2. Self-hosted uploader (Lsky Pro, Chevereto): your own web upload page, ideal if you want to offer image hosting to others.

    While writing: screenshot → drag into PicGo → paste. The direct link is just your domain plus the path.

    Checklist
    • You uploaded an image and got a working direct link
    • PicGo or the CLI is configured
    • The link lands on your clipboard
  5. Step 5 · Wire it into your site + backup + monetise

    Serve all images from your host, back it up, keep keys secret, add affiliates

    With the host running, use it — and earn a little from it.

    Wire it in: serve every post image and site asset from your own bucket, so everything is managed and swappable in one place. To offer public image hosting, put an Lsky Pro front end on it.

    Backup: the images are your asset. Use cross-region replication, or sync the bucket to another bucket or local disk periodically — never keep a single copy.

    Monetise: put cloud-storage affiliate links on your image-hosting page or blog sidebar. Someone reading an image-hosting tutorial is about to open a bucket anyway, so the conversion is natural.

    Security: keep API keys on your server or in PicGo's local config. Never put them in front-end JS — leak them and someone can delete your whole bucket.

    Checklist
    • Site images are served from your own host
    • There is an off-site backup strategy
    • Promotional placements are labelled
    • No keys appear in front-end code

More questions about Self-hosted Image Hosting / Object Storage

How many steps does Self-hosted Image Hosting / Object Storage take, and how long will it take?

5 steps, about 1.5 hours: 1) Create the bucket + basic settings; 2) Custom domain + CDN; 3) Hotlink protection + cost control; 4) Upload toolchain (drag, get a link); 5) Wire it into your site + backup + monetise. Every step ships with instructions, a copy-paste script and a checklist.

What is the first step for Self-hosted Image Hosting / Object Storage?

Create the bucket + basic settings — Pick a region, public-read / private-write, standard storage. Everything after it builds on this step.

How do I know I did Self-hosted Image Hosting / Object Storage right?

Wire it into your site + backup + monetise — Serve all images from your host, back it up, keep keys secret, add affiliates. The checklist in that step is your acceptance test: tick every box before you call it live.