Koha Solutions

Configuration & operations

HTTPS for Koha's OPAC and staff interface with Let's Encrypt

Both Koha sites need a certificate, not just the public one. Here is the whole procedure for an existing instance, and the two system preferences that have to be updated or Koha keeps emailing people http:// links.

Updated 2026-08-12 · Tested against Koha 26.05

Give both sites a certificate — patrons log in to the OPAC to see their own borrowing record, and staff log in to everything. On an existing instance that is certbot --apache naming both hostnames, followed by setting OPACBaseURL and staffClientBaseURL to their https:// addresses. Skip that last step and Koha keeps putting http:// links in its notices.

Both hostnames must resolve to this server first

Let's Encrypt proves control by fetching a file over the name you are asking for. If the DNS record does not exist yet, or still points somewhere else, issuance fails and the error blames the challenge rather than the DNS.
  • Check each name resolves to this machine: dig +short opac.example.org.
  • Port 80 must be reachable from the internet — the HTTP challenge arrives there.
  • Take a copy of the site file before certbot edits it: sudo cp /etc/apache2/sites-available/library.conf /root/library.conf.bak

Step 1Know both hostnames

A Koha instance is two websites. Get both names from the site file rather than from memory:

Terminal
$ grep -i ServerName /etc/apache2/sites-available/library.conf    ServerName library.example.org   ServerName library-intra.example.org

If the staff interface is on a port rather than its own hostname — the default :8080 arrangement — give it a hostname first. A certificate is issued for a name, not for a port, so this is the step that has to happen before any of the rest: see Koha, Apache and port 8080.

Step 2Issue the certificate

Terminal
$ sudo apt -y install certbot python3-certbot-apache$ sudo a2enmod ssl$ sudo certbot --apache \    -d library.example.org -d library-intra.example.org

Certbot asks for an email address, obtains the certificate and rewrites the virtual hosts to serve it. Answer yes when it offers to redirect HTTP to HTTPS — an OPAC that answers on both is a login page reachable in plain text.

Terminal
$ sudo apache2ctl configtest Syntax OK$ sudo systemctl reload apache2

Step 3Tell Koha its own addresses

This is the step that gets missed, and it is invisible until a patron complains. Koha builds absolute URLs for password resets, hold notices and staff links from two system preferences, and they still say http://.

  1. 1In the staff interface, go to Administration → Global system preferences.
  2. 2Set OPACBaseURL to https://library.example.org — no trailing slash.
  3. 3Set staffClientBaseURL to https://library-intra.example.org.
  4. 4Save, then send yourself a password reset from the OPAC and check the link in the mail is https.

Why a wrong value here is worse than an empty one

A notice that carries a plain-http link teaches patrons to log in over an unencrypted page, and on a site that now redirects, some mail clients and gateways will flag or rewrite the link. The preferences are also what several integrations read to find the catalog.

Step 4Prove the renewal works

Certificates last ninety days. Certbot installs a timer to renew them, and the only way to know it works is to make it try:

Terminal
$ sudo certbot renew --dry-run Congratulations, all simulated renewals succeeded

Do this on the day you issue, not on the day it expires. A renewal that has never been tested is the most reliable way to have a library catalog go down on a Saturday with a browser warning nobody on site can clear.

On a brand-new instance

If the instance does not exist yet, koha-create can set it up as HTTPS-only from the start:

Terminal
$ sudo a2enmod ssl$ sudo koha-create --create-db --letsencrypt library

It refuses to run without mod_ssl and installs the Let's Encrypt client itself if it is missing. The DNS records still have to exist first — the same requirement, just earlier in the day.

Why the OPAC needs this as much as the staff side

It is tempting to certificate the staff interface and leave the public catalog alone, on the grounds that a catalog is public information. It is not the catalog that needs protecting — it is the patron. A patron signs in to see what they have borrowed, what they owe and what they have reserved, and over plain HTTP that password and that reading history cross every network between them and the library in the clear. On campus wifi, that is a real exposure.

There is a practical layer too. Browsers mark plain-HTTP login forms as "Not secure" in the address bar, which for a library is a public statement about how it handles member data. Several browser features a modern OPAC theme may use are restricted to secure contexts. And an institution's own security review will eventually reach the catalog, at which point this becomes urgent rather than planned.

The cost is one command and a timer. There is no version of this argument where it is not worth doing.

One last thing to check afterwards, because it fails quietly: if Plack is enabled, restart it so nothing is serving a cached configuration — and if the site starts returning 502 rather than a certificate warning, that is Plack, not TLS.

Share this article

Would rather not do this yourself? We do it as a service — and if you would rather it were already done, it is on Koha Cloud before you log in.