FotobogenDocumentation

Your own domain, start to finish

From nothing to your photographs at https://photos.example.com: buy a domain, rent a server, point the one at the other, install Fotobogen, keep it running, and put nginx and HTTPS in front of it. Every command is written out in full.

Who this is for. The step-by-step tracks below take about an hour, most of it typing commands into a terminal on a server you rent. Nothing here needs you to write code, but there are several moving parts, and each step checks the one before. If the terminal is not for you, start with the quick way, which needs none; or someone who has set up a website before can do the tracks in fifteen minutes. Either way, after that everything happens in Fotobogen's admin in a browser.

The quick way: one paste on DigitalOcean

When you create a DigitalOcean droplet, you can give it a short script to run the first time it starts. Paste the three lines below there, and the droplet sets itself up: the firewall, swap on a small server, Node.js, Fotobogen's newest release under pm2, and Caddy in front, which gets the HTTPS certificate by itself. No terminal, no nginx, no Certbot. It is the same set-up as the plain-server track, with Caddy in nginx's place.

  1. Buy a domain (step 1), or skip this to start without one: see below.
  2. Create a droplet on DigitalOcean: Ubuntu 24.04 (LTS), the 2 GB size if you can (1 GB works: swap is added for you, and the install takes longer). Choose how to log in, an SSH key or a password; either works.
  3. Paste the script. Under Advanced options, tick the box for initialization scripts (user data), and paste, with your domain on the second line:
    #!/bin/bash
    export FOTOBOGEN_DOMAIN=photos.example.com
    curl -fsSL https://raw.githubusercontent.com/cschweda/fotobogen/main/deploy/droplet-setup.sh | bash
  4. Create the droplet, copy its IP address, and add the A record for your domain (step 3). The order does not matter: Caddy keeps trying until the domain points at the server, and HTTPS starts by itself once it does.
  5. Wait about ten minutes (longer on 1 GB). Until it is ready, the address shows "Fotobogen is being installed on this server".
  6. Get the setup token. On the droplet's page in DigitalOcean, open the Console. It logs you in in the browser, and the message at the top says where Fotobogen is and shows the token. (If it says Fotobogen is still being installed, close it and look again in a few minutes.)
  7. Open your address, enter the token, and go on to the finish.

No domain yet? Leave the second line as export FOTOBOGEN_DOMAIN=, with nothing after the =. The site then lives at the server's own address written as a name, such as https://203-0-113-10.sslip.io (from the free service sslip.io), with HTTPS, and the Console shows it with the token. When you have a domain, point it at the server, open the Console, and run the script again with the domain:

curl -fsSL https://raw.githubusercontent.com/cschweda/fotobogen/main/deploy/droplet-setup.sh | sudo bash -s photos.example.com

That changes only the address; your photos and settings stay. Then set the site's address under Admin, Search and sharing too, if you had set one there.

Which are you using?

Steps 1 to 3 are the same for everyone. After that, follow one track:

Both end in the same place: Fotobogen running under pm2, behind nginx, with HTTPS, and a setup wizard waiting in your browser.

What you pay forRoughly
A domain name$10 to $20 a year, depending on the ending (.com, .photo, …)
A server with 2 GB of memory (recommended)About $12 a month
A server with 1 GB of memory (works, with swap)About $6 a month
Laravel Forge, if you choose that trackForge's own monthly plan, as well as the server

Prices are what the larger providers charged when this was written; check theirs. The requirements say what Fotobogen needs from the server.

Throughout this page, photos.example.com stands for your domain and 203.0.113.10 for your server's address. Put yours in their place wherever they appear.

1. Buy a domain

A domain is bought, by the year, from a registrar. Any registrar works; three that are straightforward to use:

Search for the name you want, add it to the cart, and pay. Turn on auto-renew, so the domain does not lapse in a year.

A whole domain, or part of one? Fotobogen can be the whole of yourname.com, or live at a subdomain like photos.yourname.com, leaving the rest of the domain for other things. If you already own a domain, a subdomain costs nothing more. This page uses a subdomain; where the whole domain is different, it says so.

2. Rent a server

On either track the server is a rented Linux machine (a VPS). Choose Ubuntu 24.04 LTS, and 2 GB of memory if you can; 1 GB works with the swap step below.

When it is created, the provider shows its IP address, four numbers like 203.0.113.10. Copy it: the next step needs it.

On the Forge track, Forge creates this server for you: see Forge, step 1, then come back for step 3.

3. Point the domain at the server

Do this now, before installing anything. A change to DNS can take a few minutes, occasionally a few hours, to reach everyone, and HTTPS cannot be set up until it has.

What you add is an A record: a line that says "this name is at this address".

FieldFor photos.example.comFor the whole of example.com
TypeAA
Name (or Host)photosLeft empty, or @
Value (or Answer, Content, Points to)203.0.113.10203.0.113.10
TTLThe lowest offered, or AutomaticThe same

Where to add it, at each of the registrars above (the pages are rearranged now and then, so the names may differ a little):

If the server also has an IPv6 address (it looks like 2001:db8::1), you can add an AAAA record for it the same way. It is optional.

Check it. On your own computer, in a terminal:

nslookup photos.example.com

When the answer includes 203.0.113.10, it has taken effect. Until then, carry on: the next steps do not need it until HTTPS.

Track A: a plain server

Ubuntu 24.04 on a DigitalOcean droplet, or any provider's equivalent. You will install nginx, Node.js, and pm2 yourself.

A1. Log in and make a user

When creating the droplet, choose SSH key as the way to log in, and add your computer's key (DigitalOcean explains how on the same page). Then, from your computer:

ssh root@203.0.113.10

Running a website as root is a bad habit, so make an ordinary user, here called photos, that can use sudo, and let your key log in as it:

adduser photos                   # asks for a password: choose one and keep it
usermod -aG sudo photos
rsync --archive --chown=photos:photos ~/.ssh /home/photos

Bring the system up to date, install nginx and git, and switch on the firewall with only SSH and the web open:

apt update && apt upgrade -y
apt install -y nginx git
ufw allow OpenSSH
ufw allow 'Nginx Full'
ufw enable                       # answer y

Log out (exit) and log back in as the new user. Everything from here on is done as photos:

ssh photos@203.0.113.10

Check: opening http://203.0.113.10 in a browser shows "Welcome to nginx!".

A2. On a 1 GB server, add swap

Building Fotobogen needs more memory than running it. With 2 GB or more, skip this.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

A3. Install Node.js 24, pnpm, and pm2

With nvm, which keeps Node.js in your own folder:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source ~/.nvm/nvm.sh
nvm install 24
npm install -g pnpm@10 pm2

Check: node --version prints v24 and some more.

A4. Install Fotobogen

cd ~
npx fotobogen@latest fotobogen

It checks the tools, fetches the newest release into ~/fotobogen, installs, and builds, which takes a few minutes. Answer no when it offers to start it: pm2 starts it in the next step. Then tell it its address:

cd ~/fotobogen
pnpm fotobogen init

It asks three things. Press Enter for the port (5150). For the site address, type https://photos.example.com. Answer no to demo mode.

A5. Start it under pm2

pm2 keeps Fotobogen running, restarts it if it stops, and, once told to, starts it again when the server reboots. The file it needs, ecosystem.config.cjs, comes with Fotobogen and needs no editing.

pm2 start ecosystem.config.cjs
pm2 save
pm2 startup

pm2 startup prints one long command beginning with sudo env PATH=. Copy that whole line, paste it, and run it.

Now find the setup token, 32 letters and digits that the first visit asks for:

pm2 logs fotobogen               # Control + C to leave; the token is also in ~/fotobogen/data/setup-token

Check: pm2 status shows fotobogen as online, and

curl http://127.0.0.1:5150/api/health

answers with "status":"ok". Fotobogen is running, but only the server itself can reach it. The next step opens it to the world.

A6. Put nginx in front of it

nginx answers visitors on the usual web ports and passes each request to Fotobogen on port 5150. Create the site's file:

sudo nano /etc/nginx/sites-available/photos.example.com

Paste this in, with your domain on the server_name line:

server {
    listen 80;
    listen [::]:80;
    server_name photos.example.com;

    # The largest upload nginx lets through. Keep it equal to MAX_UPLOAD_MB.
    client_max_body_size 50m;

    # Once the site has its certificate: browsers that have visited use https from then on.
    add_header Strict-Transport-Security "max-age=31536000" always;

    location / {
        proxy_pass http://127.0.0.1:5150;
        proxy_http_version 1.1;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 120s;
    }
}

Save (Control + O, Enter) and close (Control + X). Switch it on, switch off nginx's welcome page, check, and reload:

sudo ln -s /etc/nginx/sites-available/photos.example.com /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t                    # must say "syntax is ok" and "test is successful"
sudo systemctl reload nginx

What each line of the file does is explained in nginx in front of the app. Leave the Host line in: without it, saving anything in the admin fails.

Check: once the domain has taken effect (step 3), http://photos.example.com shows Fotobogen's setup page. Do not set it up yet: logging in needs HTTPS.

A7. Add HTTPS

Certbot gets a free certificate from Let's Encrypt and renews it by itself:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d photos.example.com

It asks for an email address (for renewal warnings) and to accept the terms, then edits the nginx file to use the certificate and send http visitors to https. If it says the domain could not be reached, the A record has not taken effect yet: wait, check with nslookup, and run the second line again.

Check: https://photos.example.com opens with a padlock. Go on to the finish.

Track B: Laravel Forge

Forge creates and looks after the server: it installs nginx, manages each site's nginx file, and issues and renews certificates. Fotobogen runs under pm2 as Forge's forge user, and Forge's nginx passes requests to it. Forge is made for PHP sites, so a few steps below go around the PHP parts.

B1. Create the server

In Forge, connect your server provider (DigitalOcean, Hetzner, and others; or use Custom VPS for a server you already rent), then create a server: Ubuntu 24.04, 2 GB of memory if you can. Forge emails you the passwords for sudo and the database; keep that email. When the server is ready, copy its IP address from its page, and do step 3, the A record, now.

Add your computer's SSH key to the server (the server's SSH Keys tab), so you can log in as forge.

B2. Create the site

On the server, create a site with the domain photos.example.com. For the project type, pick one with no PHP (Static HTML, or Other). Then install a repository into it: provider GitHub, repository cschweda/fotobogen, branch main. Leave Composer and any database unticked.

Forge puts it in /home/forge/photos.example.com.

B3. Install Node.js 24, pnpm, and pm2

Log in as forge:

ssh forge@203.0.113.10

Forge may already have put a Node.js on the server, often an older one. Fotobogen needs 24:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source ~/.nvm/nvm.sh
nvm install 24
nvm alias default 24
npm install -g pnpm@10 pm2

On a 1 GB server, add swap as on the plain track.

Check: node --version prints v24.

B4. Build it and start it under pm2

cd /home/forge/photos.example.com
pnpm install --frozen-lockfile
pnpm build
pnpm fotobogen init              # Enter for the port; the site address is https://photos.example.com; no to demo mode
pm2 start ecosystem.config.cjs
pm2 save
pm2 startup

Run the sudo env PATH=… line that pm2 startup prints; it asks for the sudo password from Forge's email. Then find the setup token:

pm2 logs fotobogen               # Control + C to leave; the token is also in data/setup-token

Check: curl http://127.0.0.1:5150/api/health answers with "status":"ok".

B5. Point Forge's nginx at it

In Forge, open the site, then Edit Files, Edit Nginx Configuration. Forge wrote this file for a PHP site. Inside its server { … } block, find the location / { … } block and replace it, and only it, with:

client_max_body_size 50m;
add_header Strict-Transport-Security "max-age=31536000" always;

location / {
    proxy_pass http://127.0.0.1:5150;
    proxy_http_version 1.1;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_read_timeout 120s;
}

Delete three more blocks if the file has them: location ~ \.php$ { … }, and the two one-line blocks location = /favicon.ico and location = /robots.txt. Those two answer from the empty folder on disk, so your site's icon and its note to search engines would never reach Fotobogen. Leave everything else as Forge wrote it: the listen and server_name lines, the certificate lines, and its include lines. Save; Forge checks the file and reloads nginx. If it reports an error, the message names the line.

A faster version, in which nginx sends the resized photos straight from disk, is in deploy/forge-nginx.conf. The block above is all that is needed.

B6. Add HTTPS

On the site's SSL tab, choose Let's Encrypt and obtain a certificate for photos.example.com. Forge installs it, renews it, and adds it to the nginx file. If Forge says it could not verify the domain, the A record has not taken effect yet: check with nslookup, wait, and try again.

B7. Make "Deploy Now" update it

On the site's Deployments tab, replace the deploy script with:

cd /home/forge/photos.example.com
source ~/.nvm/nvm.sh
git pull origin $FORGE_SITE_BRANCH
pnpm install --frozen-lockfile
pnpm build
pm2 reload ecosystem.config.cjs --update-env

The source line matters: Forge runs the script without your login's setup, and without it Node.js is not found. Leave Quick Deploy off, so the site changes only when you choose.

Check: https://photos.example.com opens with a padlock.

The finish: set up the site

Open https://photos.example.com. The setup wizard asks for the token from the pm2 logs, a name for the site, and an admin account; the first run goes through each screen. After that, everything is done in the admin in your browser.

Three things worth doing in the first week:

Updating later is a button in the admin; see Updating. On the Forge track, Deploy Now does the same.

If something is wrong

What you seeWhat it means
The browser says the site cannot be foundThe A record has not taken effect, or has a typing mistake. nslookup photos.example.com should show the server's address
Certbot, or Forge's SSL tab, cannot verify the domainThe same: wait for the A record. On the plain track, also check that sudo ufw status lists Nginx Full
"Welcome to nginx!" instead of Fotobogennginx's default site is still on (sudo rm /etc/nginx/sites-enabled/default, then reload), or server_name does not match the domain
502 Bad GatewayFotobogen is not running, or is on another port. pm2 status, then pm2 logs fotobogen says why
Saving in the admin says "This request did not come from this site"The proxy_set_header Host $http_host; line is missing from nginx
Logging in says it needs a secure connectionThe site is being used over http. Finish the HTTPS step
An upload fails with 413client_max_body_size in nginx is smaller than the file
The build stops with "JavaScript heap out of memory", or is "Killed"The server ran out of memory: add swap and build again
Fotobogen refuses to start and says what to fixIts check of the machine found a problem; the message names it. See requirements

More on nginx, and on fitting Fotobogen beside other sites on a server that already has them: nginx in front of the app and an existing droplet with nginx.

Back: Installation Next: Configuration