Koha Solutions

Installation & setup

Koha, Apache and port 8080: staff and OPAC on two hostnames

Koha serves two websites from one install. Here is how the OPAC and the staff interface are separated, why staff lands on port 8080, and how to move it off.

Updated 2026-08-09 · Tested against Koha 26.05

A Koha instance is two websites: the public OPAC and the staff interface. koha-create writes one Apache virtual host for each, and by default the OPAC answers on port 80 while staff answers on port 8080. So a fresh install reaches staff at http://your-server:8080. When that port does not answer, it is almost always because Apache was never told to listen on it.

Step 1Make sure Apache is listening on 8080

This is the entire problem in most cases. A <VirtualHost *:8080> on a port Apache is not listening on does nothing at all, and produces no error to tell you so.

Terminal
grep -R "^Listen" /etc/apache2/ports.conf Listen 80

If Listen 8080 is not in the output, add it and reload:

Terminal
echo "Listen 8080" | sudo tee -a /etc/apache2/ports.confsudo apache2ctl configtestsudo systemctl reload apache2

configtest before reload, every time

Apache refuses to start on a bad config, so an untested edit on a live server takes the OPAC down along with the staff interface. apache2ctl configtest costs a second and turns an outage back into a typo.

Step 2Make sure the site is enabled

Terminal
sudo a2ensite librarysudo a2enmod rewrite cgisudo systemctl reload apache2

The site file is /etc/apache2/sites-available/library.conf, named after the instance. Both virtual hosts live in that one file, which is why enabling or disabling it affects the OPAC and staff together.

Step 3Use two hostnames instead of a port

Port 8080 is a default, not a requirement, and it is a poor one for a library: it is blocked on many institutional networks, it is awkward to certificate, and staff have to remember it. The better arrangement is two hostnames, both on the standard port.

Set it in /etc/koha/koha-sites.conf before running koha-create:

/etc/koha/koha-sites.conf
DOMAIN=".example.org"INTRAPORT="80"INTRAPREFIX=""INTRASUFFIX="-intra"OPACPORT="80"OPACPREFIX=""OPACSUFFIX=""

With those values an instance named library gives you an OPAC at library.example.org and staff at library-intra.example.org, both on port 80. The names are built as <PREFIX><INSTANCE><SUFFIX><DOMAIN>:<PORT> — documented in that file, and worth reading before inventing a scheme of your own.

Both hostnames need a DNS record

Two virtual hosts on port 80 are told apart by the Host header, so each name must resolve to the server. If only the OPAC name has a record, requests for the staff name never arrive and Apache serves the first virtual host instead — which presents as "the staff URL shows the OPAC".

Changing it on an instance that already exists

Editing koha-sites.conf only affects instances created after the edit. For one that already exists, change the virtual host directly.

  1. 1Edit /etc/apache2/sites-available/library.conf and change <VirtualHost *:8080> to <VirtualHost *:80>.
  2. 2Set ServerName on that block to the staff hostname you want.
  3. 3Add a DNS record for that hostname pointing at the server.
  4. 4Update the staffClientBaseURL system preference so the links Koha generates — including the ones inside notices — point at the new address.
  5. 5Run sudo apache2ctl configtest, then sudo systemctl reload apache2.

The system preference matters more than it looks. Koha builds absolute URLs for password resets and hold notices from it, and a stale value sends both patrons and staff to an address that no longer answers.

Then put HTTPS in front of both

Once each site has its own hostname, a certificate is straightforward — and both sites need one. Staff log in with a password, and patrons log in to see their own borrowing record; neither belongs on plain HTTP. koha-create even takes a --letsencrypt flag for new instances.

Set OPACBaseURL and staffClientBaseURL to the https:// addresses afterwards, or Koha carries on generating links back to plain HTTP.

Troubleshooting

What you seeWhat it usually is
Port 8080 refuses the connectionNo Listen 8080 in ports.conf, or a firewall. Check in that order.
The staff URL shows the OPACThe staff hostname has no DNS record, so Apache falls back to the first matching virtual host.
OPAC works, staff is a 404The site is not enabled (a2ensite), or the instance name in the file does not match.
Every page is a 500mod_cgi or mod_rewrite is not enabled. sudo a2enmod cgi rewrite.
Works on the server, not from outsideThe firewall allows 80 but not 8080 — the strongest argument for moving staff onto its own hostname.
Login redirects to the wrong addressstaffClientBaseURL or OPACBaseURL still holds the old URL.

Cannot log in once the page does load? The credentials are generated per instance — see finding your Koha admin password.

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.