Author: Ziyun Li
Last Updated: Wed, May 5, 2021ArchiveBox is a self-hosted internet archiving solution to preserve and view sites offline. This guide explains how to self-host ArchiveBox on a Vultr One-Click Docker application, and publish it with a Caddy reverse proxy.
Log in to your One Click Docker as root via SSH.
Switch to the docker user.
# su - docker
Create a new empty directory for ArchiveBox and it's data.
$ mkdir ~/archivebox && cd ~/archivebox
Download the official Docker Compose file for ArchiveBox.
$ curl -O 'https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/master/docker-compose.yml'
(Optional) You can set a restart policy for ArchiveBox.
For example, to always restart automatically, edit docker-compose.yml
and set restart: always
, as shown here.
services:
archivebox:
image: ${DOCKER_IMAGE:-archivebox/archivebox:latest}
command: server --quick-init 0.0.0.0:8000
ports:
- 8000:8000
restart: always
environment:
- ALLOWED_HOSTS=*
- MEDIA_MAX_SIZE=750m
volumes:
- ./data:/data.
Run the initial setup.
docker-compose run archivebox init --setup
Enter the username, email address, and password for the Web UI admin user.
Start the server at localhost:8000
docker-compose up -d
Return to the root user account. All the following steps should be run as root.
$ exit
Vultr's One Click Docker has the UFW firewall enabled and allows SSH traffic on port 22. To allow access to the web server, enable HTTP on port 80 and HTTPS on port 443.
# ufw allow 80
# ufw allow 443
Enable the firewall and verify the status.
# ufw enable
# ufw status
Caddy handles SSL/TLS certificates and reverse-proxies the web traffic to ArchiveBox. You must be able to resolve your server by name for Caddy's automatic certificates to work.
Point your server's DNS A record to the IP address of your Vultr One Click Docker server.
Verify the DNS records are correct. Replace the name below with your server's DNS name.
# dig archivebox.example.com
Verify you have a valid Answer Section, and the IP address matches your server's DNS name.
;; ANSWER SECTION:
archivebox.example.com. 3600 IN A 192.0.2.123
Install Caddy.
# apt install -y debian-keyring debian-archive-keyring apt-transport-https
# curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
# curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
# apt update
# apt install caddy
Edit Caddy's configuration file.
# nano /etc/caddy/Caddyfile
Replace the contents with the lines below, and substitute your server's domain name.
archivebox.example.com
reverse_proxy localhost:8000
Reload the configuration.
# caddy reload --config /etc/caddy/Caddyfile
Navigate to your new site by name to verify it works. For example:
https://archivebox.example.com
See these links for more information.