Gokapi
Overview
This guide covers the deployment and configuration of Gokapi 2.2.4 on Ubuntu 24.04 on Azure, using SecureAnyCloud Azure Marketplace images. Gokapi is a lightweight, open source, self-hosted file-sharing server. You sign in to an admin panel and upload files, and Gokapi gives you a shareable download link for each one, with per-file controls for expiry, download count, an optional password and image hotlinking.
Gokapi is a lean, privacy-respecting alternative to third-party file-transfer services, and your files stay on infrastructure that you control.
The image installs the official Gokapi v2.2.4 release binary, a single statically linked Go binary, and verifies it by SHA-256 at install time. The AGPL-3.0 licence text ships alongside it. The backend is a local SQLite database with files stored on the VM's own disk, so there is no external database, no object store and no database port to secure.
Security model. Gokapi's own first-run setup wizard is unauthenticated, so SecureAnyCloud completes setup at build time. No open setup wizard is ever exposed on your instance. Gokapi binds to 127.0.0.1:53842 only, and nginx fronts it on port 80.
The admin and management surface (/admin, /api/, /users, uploads, ...) is guarded by per-VM HTTP Basic Auth, layered over Gokapi's own admin login. The Basic Auth password is minted uniquely on first boot. Together they give defence in depth on everything that can change state.
The public download endpoints (/d, /downloadFile, /dh, /h) are intentionally left open, so the links you share resolve for their recipients without a login. This is the whole point of a file-sharing server. The only ports exposed are SSH (22) and the web UI (80, with 443 available for you to add TLS).
What you get:
- Gokapi 2.2.4 official release binary at
/usr/local/bin/gokapi(SHA-256-verified) gokapi.servicesystemd unit running the server bound to127.0.0.1:53842nginxreverse proxy on port 80: public download links open, admin surface behind per-VM HTTP Basic Authgokapi-firstboot.servicesystemd oneshot that mints the per-VM admin password and Basic Auth password on first boot- A local SQLite database at
/var/lib/gokapi/data/gokapi.sqlitewith files stored under/var/lib/gokapi/data - A credential self-test at
/usr/local/sbin/gokapi-credcheck.sh - The AGPL-3.0 licence text at
/usr/local/share/gokapi/LICENSE.md - Ubuntu 24.04 LTS base with the latest security patches applied at build time
- 24/7 SecureAnyCloud support with a guaranteed 24 hour response SLA
Prerequisites
- An active Azure subscription
- A subscription to the Gokapi on Ubuntu 24.04 listing on Azure Marketplace
- An SSH public key for VM authentication
- A virtual network and subnet in the target region
Recommended virtual machine size: Standard_B2s (2 vCPU, 4 GB RAM). Gokapi is lightweight, so scale up only if you share very large files or serve many concurrent downloads.
Deploy from the Azure Portal
Open Marketplace in the Azure Portal, search for Gokapi, select the SecureAnyCloud publisher entry, and click Create.
On the Networking tab, attach a network security group that allows inbound TCP 22 from your management IP range. The group must also allow TCP 80 from the client networks that will use the file-sharing UI and download links.
The admin surface on port 80 is protected by a per-VM Basic Auth password, but you should still restrict source ranges. Add TLS (port 443) before sharing anything sensitive, as described in Step 9.
Click Review + create, wait for validation, and then click Create. Deployment takes around two minutes.
Deploy from the Azure CLI
RG="gokapi-prod" LOCATION="eastus" az group create --name "$RG" --location "$LOCATION"
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:gokapi-ubuntu-24-04:default:latest
az vm create \
--resource-group "$RG" \
--name gokapi-01 \
--image sac1647283583153:gokapi-ubuntu-24-04:default:latest \
--size Standard_B2s \
--admin-username azureuser \
--generate-ssh-keys \
--public-ip-sku Standard
# Allow SSH (22) and the web UI + download links (80) from your trusted ranges az vm open-port --resource-group "$RG" --name gokapi-01 --port 22 --priority 1001 az vm open-port --resource-group "$RG" --name gokapi-01 --port 80 --priority 1002Replace <publisher>:<offer>:<sku> with the URN shown on the Marketplace listing's Usage Information tab.
Connect via SSH
ssh azureuser@<vm-public-ip>Use the private key that matches the public key you supplied at deploy time. The login user for this image is azureuser.
Verify the Gokapi Service
Confirm that the Gokapi server and the nginx proxy are running, and check the listening sockets. Gokapi binds to 127.0.0.1:53842 only, so it is reachable from outside the VM solely through nginx on port 80. The AGPL-3.0 licence ships with the image.
gokapi --version systemctl is-active gokapi nginx
sudo ss -ltn | grep -E ':80 |:53842' head -2 /usr/local/share/gokapi/LICENSE.mdExpected output:
Gokapi v2.2.4 active active LISTEN 0 4096 127.0.0.1:53842 0.0.0.0:* LISTEN 0 511 0.0.0.0:80 0.0.0.0:* LISTEN 0 511 [::]:80 [::]:* GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007Retrieve Your Per-VM Credentials
On the first boot of your virtual machine, gokapi-firstboot.service generated two secrets that are unique to your instance. They are the Gokapi admin login password and the nginx Basic Auth password for the admin surface. The service wrote both to a root-only file. Retrieve them with this command:
sudo cat /root/gokapi-credentials.txtThe file reports the URL, the Basic Auth credential that guards the admin surface, and the Gokapi admin login:
gokapi.url=http://<vm-public-ip>/ gokapi.basicauth.user=admin gokapi.basicauth.pass=<generated-per-vm> gokapi.admin.user=admin gokapi.admin.pass=<generated-per-vm>A shipped self-test confirms the whole credential model without printing any secret. It proves that the public surface is open, that the admin surface rejects missing and wrong Basic Auth, and that the per-VM admin login round-trips:
sudo bash /usr/local/sbin/gokapi-credcheck.shExpected output:
OKUnderstand the Access Model
Gokapi is a file-sharing server, so its download links are public. Recipients fetch them with no login.
Everything that can change state is protected. The admin surface requires the per-VM HTTP Basic Auth password, and then Gokapi's own admin login on top. You can see both halves with curl:
BASIC_PW=$(sudo grep '^gokapi.basicauth.pass=' /root/gokapi-credentials.txt | cut -d= -f2-)
curl -s -o /dev/null -w 'public /login -> HTTP %{http_code}\n' http://127.0.0.1/login
curl -s -o /dev/null -w '/admin no auth -> HTTP %{http_code}\n' http://127.0.0.1/admin
curl -s -o /dev/null -w '/admin wrong pw -> HTTP %{http_code}\n' -u 'admin:definitely-wrong' http://127.0.0.1/admin
curl -s -o /dev/null -w '/admin per-VM -> HTTP %{http_code}\n' -u "admin:$BASIC_PW" http://127.0.0.1/adminExpected output:
public /login -> HTTP 200 /admin no auth -> HTTP 401 /admin wrong pw -> HTTP 401 /admin per-VM -> HTTP 200Sign In and Share Files
In a browser, go to http://<vm-public-ip>/admin. The browser first prompts for HTTP Basic Auth. Enter user admin and the gokapi.basicauth.pass value from Step 5.
Gokapi then shows its own login page. Sign in with user admin and the gokapi.admin.pass value from Step 5:
After you sign in, you land on the Upload panel. Drag files onto the drop zone, or click to select them, and set an optional download limit, expiry and password.
Each uploaded file appears in the table below with its own share ID and a set of actions: copy the share URL, open the share dialog, download, edit or delete.
How Recipients Download
Share the link Gokapi generates (for example http://<vm-public-ip>/d/<id>/<filename>). Recipients open it in any browser with no login and see a clean download page for just that file:
You can automate the same flow with the Gokapi API. Create an API key in the API menu of the admin panel, and then upload and share files programmatically. The uploaded file's UrlDownload resolves anonymously through nginx:
# On any client, with an API key created in the admin panel's API menu:
curl -s -H "apikey: <your-api-key>" -F 'file=@report.pdf' \
http://<vm-public-ip>/api/files/add | jq -r .FileInfo.UrlDownload
# -> http://<vm-public-ip>/d/<id>/report.pdf (open with no login)Put TLS in front of Gokapi
The UI and download links are served over plain HTTP on port 80. Before you share anything sensitive, terminate TLS in front of Gokapi. Add a Let's Encrypt certificate to the bundled nginx:
sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.example.comFirst, point your DNS A record at the VM's public IP and open port 443 in the network security group. Certbot updates the bundled nginx vhost in place and preserves the access model.
After you add a custom domain, update Gokapi's own external URL so that generated links use it:
sudo -u gokapi GOKAPI_CONFIG_DIR=/etc/gokapi GOKAPI_DATA_DIR=/var/lib/gokapi/data \
/usr/local/bin/gokapi --reconfigure
# follow the prompts, or edit ServerUrl in /etc/gokapi/config.json
sudo systemctl restart gokapiChange the Passwords
To rotate the Basic Auth password on the admin surface, update the htpasswd file and then reload nginx:
sudo htpasswd /etc/nginx/.gokapi.htpasswd admin
sudo systemctl reload nginxTo rotate the Gokapi admin login password non-interactively:
sudo -u gokapi GOKAPI_CONFIG_DIR=/etc/gokapi GOKAPI_DATA_DIR=/var/lib/gokapi/data \
/usr/local/bin/gokapi --deployment-password '<new-password>'
sudo systemctl restart gokapiConnect Object Storage (Optional)
By default, files are stored on the VM's local disk with metadata in SQLite. To store files in an S3-compatible object store instead, run Gokapi's reconfigure wizard and provide your bucket, region, keys and endpoint:
sudo systemctl stop gokapi
sudo -u gokapi GOKAPI_CONFIG_DIR=/etc/gokapi GOKAPI_DATA_DIR=/var/lib/gokapi/data \
/usr/local/bin/gokapi --reconfigure sudo systemctl start gokapiSee the Gokapi cloud storage documentation for the exact S3 settings, including the CORS configuration that encrypted downloads require.
Managing the Gokapi Service
# Status and logs systemctl status gokapi --no-pager sudo journalctl -u gokapi -n 100 --no-pager
# Restart after changing configuration
sudo systemctl restart gokapi
# nginx (the reverse proxy)
sudo nginx -t && sudo systemctl reload nginxArchitecture summary
- Gokapi 2.2.4 is a single statically linked Go binary at
/usr/local/bin/gokapi. It runs as the non-rootgokapiservice account under systemd, bound to127.0.0.1:53842. - nginx on port 80 leaves the public download and share endpoints open and puts the admin and management endpoints behind per-VM HTTP Basic Auth.
- Local SQLite at
/var/lib/gokapi/data/gokapi.sqlite, with files on the VM's own disk. There is no external database and no database port. - First-boot service mints a per-VM Gokapi admin password and a per-VM Basic Auth password, sets the public URL, and writes both to a root-only credentials file. No shared or default credential ships in the image.
Support
SecureAnyCloud provides 24/7 technical support for this Gokapi image by email (sales@secureanycloud.com) and live chat, with a guaranteed 24 hour response SLA and a one hour average response time for critical issues.
The support team helps with deployment, retrieving and rotating the first-boot credentials, adding HTTPS and a custom domain, connecting S3-compatible storage, using the Gokapi API and CLI uploader, configuring file expiry and download limits, upgrades and patch management, and troubleshooting. For billing, subscription changes or refund requests, contact sales@secureanycloud.com.
All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Deploy on Azure
Launch Gokapi on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com