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
- 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:
$ grep -i ServerName /etc/apache2/sites-available/library.conf ServerName library.example.org ServerName library-intra.example.orgIf 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
$ sudo apt -y install certbot python3-certbot-apache$ sudo a2enmod ssl$ sudo certbot --apache \ -d library.example.org -d library-intra.example.orgCertbot 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.
$ sudo apache2ctl configtest Syntax OK$ sudo systemctl reload apache2Step 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://.
- 1In the staff interface, go to Administration → Global system preferences.
- 2Set OPACBaseURL to
https://library.example.org— no trailing slash. - 3Set staffClientBaseURL to
https://library-intra.example.org. - 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
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:
$ sudo certbot renew --dry-run Congratulations, all simulated renewals succeededDo 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:
$ sudo a2enmod ssl$ sudo koha-create --create-db --letsencrypt libraryIt 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.
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.
Related
More on configuration & operations
Answers to the questions that usually arrive with this one.
Koha returns 502 or 503 after enabling Plack
Apache is proxying to Plack and cannot reach it. Nearly always two missing Apache modules — koha-plack tells you which, in a warning that scrolls past.
Koha internal server error: finding the line that caused it
A 500 page is Koha telling you nothing on purpose. The real message is in that instance's error log — here is which file to read, and the two causes that produce most of them.
Rebuilding the Zebra index when Koha search results go stale
A record you can open by its number but cannot find by searching means the index is behind, not that the record is missing. Here is how to rebuild it properly.
Backing up Koha with koha-dump — and restoring it
A package install already backs itself up nightly, keeps two days, and writes to a disk that dies with the server. Here is how to check it, and how to restore.

