Operations 11 min read

How to Deploy Hugo, Gitbook, and Nginx on a Linux Server with Qiniu Image Hosting

This guide walks you through installing Hugo, creating a static blog, configuring Nginx as a reverse proxy, setting up Gitbook for documentation, and integrating Qiniu cloud storage for image handling, all on a Linux server using personal domain access.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Deploy Hugo, Gitbook, and Nginx on a Linux Server with Qiniu Image Hosting

Deploy Hugo

Download the Hugo release package from GitHub and install it on the Linux server.

$ yum -y install git golang
$ mkdir -p /app/hugo_0.74.3
$ tar xf hugo_0.74.3_Linux-64bit.tar.gz -C /app/hugo_0.74.3
$ cp /app/hugo_0.74.3/hugo /usr/local/bin/
$ hugo version

Create a site

$ hugo new site zhanminblog
$ ls
archetypes  config.toml  content  data  layouts  static  themes

Choose a theme

Clone the desired Hugo theme (e.g., Pure ) and copy its example site files into the project.

$ cd /app/zhanminblog
$ git clone https://github.com/xiaoheiAh/hugo-theme-pure themes/pure
$ rm -f config.toml
$ cp -r themes/pure/exampleSite/* /app/zhanminblog/

Create the first article

Write a Markdown file in content/posts with front‑matter defining title, author, date, etc.

$ cd /app/zhanminblog/content/posts
$ touch hello.md
$ cat hello.md
+++ 
author = "前行"
title = "第一篇文章"
date = "2020-07-29"
description = "这是我使用hugo创建的第一篇文章"
tags = ["hugo"]
categories = ["hugoblog"]
+++
# Hugo介绍
Hugo是轻量级的静态资源服务

Preview the site

Run Hugo’s built‑in server, binding to all interfaces for remote access.

$ hugo server --bind="0.0.0.0" -v -w -b http://www.unmin.club

For local testing, the default port 1313 can be used; for production, the generated public directory is copied to Nginx.

Deploy Nginx as a front‑end proxy

Install Nginx and copy the generated static files to its document root.

$ yum -y install nginx
$ rm -rf /usr/share/nginx/html/*
$ cp -r /app/zhanminblog/public/* /usr/share/nginx/html/
$ systemctl start nginx

Deploy Gitbook

Install Node.js

$ wget https://nodejs.org/dist/v12.18.1/node-v12.18.1-linux-x64.tar.xz
$ tar xf node-v12.18.1-linux-x64.tar.xz
$ export PATH=$PATH:/app/node-v12.18.1-linux-x64/bin
$ node -v

Install Gitbook CLI

$ npm install gitbook-cli -g
$ gitbook -V

Create a book

$ mkdir /app/k8s-book
$ cd /app/k8s-book
$ gitbook init
$ ls
README.md  SUMMARY.md

Configure book metadata and plugins

Edit book.json to set title, author, language, and desired plugins (e.g., anchors, code copy button, page‑footer).

Build and serve

$ gitbook build   # generates _book directory
$ gitbook serve   # local preview

Configure Nginx for Gitbook

Add an alias location pointing to the built _book directory.

server {
    listen 80 default_server;
    server_name _;
    root /usr/share/nginx/html;
    location /k8s-book {
        alias /app/k8s-book/_book;
        index index.html index.htm;
        autoindex on;
    }
}
$ nginx -s reload

Set up Qiniu Cloud as an image CDN

Register a Qiniu account, create a bucket, and obtain the temporary domain. Add a custom CNAME record at your DNS provider to point to the Qiniu CDN domain.

Use PicGo for automatic image upload

Install PicGo, configure the Qiniu bucket with AccessKey/SecretKey, and set the custom domain as the upload URL. After configuration, copied images are automatically uploaded and inserted as Markdown links.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DeploymentLinuxNGINXHugostatic siteQiniuGitbook
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.