February 6, 2021

Local Video Hosting in Ghost

Local Video Hosting in Ghost


Before you proceed, please fully understand:
When you choose to host videos locally, it will cause certain amount of outbound data transfer. Unless you subscribed a fixed bandwidth, or with enough data transfer allowance --- if your plan is pay-as-you-go for data transfer, large bills of outbound data transfer fee may occur.

1. Background

Ghost does not allow users to upload videos. You can only use third party embedded source, such as YouTube, Vimeo. This is an alternative way to host videos on the same server as Ghost.

2. Config Nginx

In your Ghost Nginx configuration file add the following alongside your Ghost proxy:

location ^~ /videos {
    root /var/www;

For example: (path may vary)

nano /etc/nginx/conf.d/ghost.conf
   location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;

# Add below three lines 
    location ^~ /videos {
        root /var/www;

3. Add videos

mkdir /var/www/videos

You can use FTP application such as FileZilla, to upload videos to this directory.

Restart Nginx

systemctl restart nginx

4. Insert videos in Ghost

You can insert video source via HTML or Markdown

<video controls width="500">
    <source src="https://your.ghost.com/videos/yourfile.mp4"

All HTML controls apply.