Using Bookstack Beyind NGINX

2020-09-13

I've recently been catching up on my documentation habit for my homelab and decided to give Bookstack a try after hearing tons of good things about.

For any personal app I use I need it to work behind my NGINX reverse proxy so that it can be accessed by a subdirectory (http://example.com/bookstack) to save on DNS registrations and Let's Encrypt certs.

As usual I leveraged the great work by the LinuxServer.io team with their prebuilt Bookstack Docker container. After setting up this using the usual config in my docker compose file and my standard snippet for NGINX to reverse proxy things, I noticed I ended up with all static assets 404!

My snippet is typically very reliable, so I hit Google and found a few people complaining about the same issue, however no fixes were ever mentioned. A little more playing around and I noticed my Grafana config had a small change as well from the usual config--there's a trailing / for the proxy_pass variable!

Couple seconds later, and we're in business! Note that trailing slash at the end, hopefully it will save you a little bit of troubleshooting!

location /bookstack {
  proxy_pass http://docker.host.local:6875/;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-Host $server_name;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Forwarded-Ssl on;
}