To self-host Apache Answer on a managed VPS is to keep the questions, answers and knowledge of your community or your team on a server of your own, which our teams keep up to date and monitor day and night. Apache Answer is a free, open source Q&A platform under the Apache-2.0 license, a project of the Apache Software Foundation. This guide follows its official Docker image at version 2.0.3, and we ran every command on a Simafri VPS before writing it: installation with Docker Compose and MySQL, the installer, HTTPS, backups, restores and upgrades.
By Simon Vasconcelos Lee
Published on 26 November 202611 minute read
apache/answer and MySQL 8.4, which the project recommends over SQLite for real use, with the port published on 127.0.0.1 behind an HTTPS reverse proxy.mysqldump and an archive of the /data volume. To update, change the image tag: the image migrates the database itself at startup.Apache Answer is a question and answer platform, in the spirit of the best known developer Q&A sites: members ask, others answer, votes bring the best answers up and the author accepts the one that solved the problem. Teams use it as a community forum, a help center or an internal knowledge base. It is written in Go with a React interface, and it graduated from the Apache Incubator to become a top-level project of the Apache Software Foundation.
Apache Answer is published under the Apache License, version 2.0. You can use it free of charge, for your community, your company or your clients, copy it, modify it and distribute it, modified or not, as long as you keep the license and copyright notices and state the changes you made to its files. The license also grants a patent license from its contributors. The software is provided without warranty.
There is no paid edition: every feature, plugins included, is in the open source code. “Apache Answer” is a trademark of the Apache Software Foundation, which publishes rules for naming a product or a service that runs it.
The documentation sets no minimum size. Here is what we measured on our test VPS, freshly installed with one question:
/data volume.Server size therefore depends on the size of your community and on the other applications you run beside it. On a managed VPS, tell us about your usage and we will recommend the right size.
Apache Answer ships as a single image, apache/answer, which serves the interface and the API on port 80 of the container, and keeps its configuration, uploads and language files in /data. It supports SQLite, MySQL and PostgreSQL; the project recommends SQLite only to try it out, and MySQL for real use, which is what we tested. On a server with Docker Engine and its Compose plugin, installed from Docker’s repository for Ubuntu, create a folder such as /opt/apache-answer and put this compose.yaml in it:
services:
answer:
image: apache/answer:2.0.3
restart: unless-stopped
environment:
- TZ=Etc/UTC
ports:
- "127.0.0.1:8105:80"
volumes:
- answer_data:/data
depends_on:
db:
condition: service_healthy
db:
image: mysql:8.4
restart: unless-stopped
environment:
- MYSQL_DATABASE=answer
- MYSQL_USER=answer
- MYSQL_PASSWORD=${MYSQL_PASSWORD:?set MYSQL_PASSWORD in .env}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:?set MYSQL_ROOT_PASSWORD in .env}
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
start_period: 60s
interval: 5s
timeout: 5s
retries: 10
volumes:
answer_data:
mysql_data:
The two database passwords go in a .env file next to it, which Docker Compose reads on its own. Create it readable by root only, then start the stack:
umask 077
printf 'MYSQL_PASSWORD=%s\nMYSQL_ROOT_PASSWORD=%s\n' "$(openssl rand -hex 24)" "$(openssl rand -hex 24)" > .env
umask 022
docker compose up -d
docker compose ps
127.0.0.1: the project’s examples publish 9080 on every address of the server. Published locally, Apache Answer is reachable only through the reverse proxy, and above all its installer is not open to the internet. Any free port will do.latest, which changes version whenever the image is pulled again. A full version, here 2.0.3, the latest release when we tested, lets you choose when each upgrade happens.127.0.0.1 on purpose: during its first initialization, the MySQL image runs a temporary server without network access, which this check does not mistake for the real one.TZ: the image is built with a UTC+8 time zone by default. Set yours, from the IANA list; on our test VPS, Etc/UTC was applied at once.answer_data for the configuration file, uploads and cache, mysql_data for the database.On first start, Apache Answer finds no configuration file and serves its installer. Wait until it answers:
until curl -sf http://127.0.0.1:8105/healthz >/dev/null; do sleep 3; done
docker compose logs answer | grep "installation service"
The installer is the web page documented as the install steps: the language, the database connection, the configuration file, then the site and the administrator. Whoever completes it first becomes the administrator, which is why the port stays on 127.0.0.1 until it is done. The page itself sends three requests, and you can send them from the terminal on the server. Replace the site name, the address and the two email addresses with yours: the administrator signs in with the email, and the site address is the public one, with https://, even before HTTPS is set up. The password is generated into admin-password.txt, between 8 and 32 characters as required:
umask 077; openssl rand -hex 12 > admin-password.txt; umask 022
DB='{"db_type":"mysql","db_username":"answer","db_password":"'$(grep ^MYSQL_PASSWORD= .env | cut -d= -f2)'","db_host":"db:3306","db_name":"answer"}'
curl -s -H "Content-Type: application/json" -d "$DB" http://127.0.0.1:8105/installation/db/check; echo
curl -s -H "Content-Type: application/json" -d "$DB" http://127.0.0.1:8105/installation/init; echo
curl -s -H "Content-Type: application/json" -d '{"lang":"en_US","site_name":"My Answer","site_url":"https://answer.example.com","contact_email":"admin@example.com","name":"admin","password":"'$(cat admin-password.txt)'","email":"admin@example.com","login_required":false,"external_content_display":"ask_before_display"}' http://127.0.0.1:8105/installation/base-info; echo
until curl -s http://127.0.0.1:8105/answer/api/v1/siteinfo | grep -q "\"code\":200"; do sleep 3; done
"msg":"Success.": the first one checks the connection to MySQL, the second writes /data/conf/config.yaml, and the third creates the tables, the site and the administrator. The installer then stops, and the image starts Apache Answer itself; the last line waits for it.db_host is db:3306, the name of the MySQL service on the Compose network, and the database password is read from .env, so it never appears in your shell history.login_required set to true makes the site private: only signed-in members can read it. external_content_display decides whether embedded external content loads by itself, or only after a click.admin-password.txt.In a browser instead, open an SSH tunnel from your computer to port 8105 of the server, then go to http://localhost:8105/install: the page asks for the same fields, in the same order. The project also documents an unattended installation, AUTO_INSTALL=true with the same values in environment variables, mainly for the binary.
The container serves Apache Answer over HTTP, on port 8105 of the server. HTTPS is handled by a reverse proxy in front of it. We tested Caddy, installed from its official Debian and Ubuntu repository: it obtains the Let’s Encrypt certificate itself, renews it, and forwards the Host header and X-Forwarded-* headers by default.
answer.example.com {
reverse_proxy 127.0.0.1:8105
}
systemctl reload caddy
curl -sI https://answer.example.com/
HTTP/2 200 with the site name as its title.X-Frame-Options: DENY and X-Content-Type-Options: nosniff, which Caddy passes on as they are.Sign in with the administrator’s email and password. On our test VPS, we published a question with an image from the API: its page came back with the question as its title, and the image was served from /uploads.
Apache Answer sends the confirmation of new accounts, password resets and notifications by email. Under Admin, Settings, SMTP, enter the host of your SMTP relay, its port and encryption, and the username and password of the sending account, then check it with a test message. On a Simafri VPS, applications send through an authenticated SMTP relay on port 587, which also gives your email the best deliverability.
apache/answer with the ones you choose, then use it in place of the official one in compose.yaml.Everything lives in three places: the MySQL database, the answer_data volume with conf/config.yaml and your uploads, and your .env file. The dump holds every account and its email address, and config.yaml holds the database password, so create the copies readable by root only, with umask 077 inside parentheses: the rest of your session keeps its usual mask. A file that already exists keeps its permissions when it is overwritten, so the last line also closes the copies already in the folder:
(
umask 077
docker compose exec -T db sh -c 'MYSQL_PWD="$MYSQL_PASSWORD" exec mysqldump --single-transaction --no-tablespaces -u answer answer' > answer-$(date +%F).sql
docker compose exec -T answer tar -C /data -czf - . > data-$(date +%F).tar.gz
cp .env env-$(date +%F).bak
chmod 600 answer-*.sql data-*.tar.gz env-*.bak
)
mysqldump reads it from the environment of the MySQL service, so it never appears on the command line.--single-transaction takes a consistent copy without locking the site, and --no-tablespaces lets the answer user, which does not hold the PROCESS privilege, run the dump.Schedule this copy and send it off the server. Stored on the disk, the files are also included in the server’s nightly backups.
On the same installation, or on a new one with the same compose.yaml and .env, stop the application, replace the database with an empty one, load the dump into it, put the files back, then start the application again:
docker compose stop answer &&
docker compose exec -T db sh -c 'MYSQL_PWD="$MYSQL_PASSWORD" exec mysql -u answer -e "DROP DATABASE answer; CREATE DATABASE answer"' &&
docker compose exec -T db sh -c 'MYSQL_PWD="$MYSQL_PASSWORD" exec mysql -u answer answer' < answer-2026-11-20.sql &&
docker compose run --rm --no-deps -T --entrypoint tar answer -C /data -xzf - < data-2026-11-20.tar.gz &&
docker compose start answer
mysql reading a file stops at the first failed statement and returns an error, and the && stop the sequence there, so Apache Answer stays stopped. On our test VPS, a damaged dump stopped at its line 460 and the application did not start. What was loaded before the error remains in the database: start again from the beginning once the cause is fixed.conf/config.yaml, Apache Answer would start its installer again.We tested the whole cycle on our VPS with these exact commands: dump and archive, the database dropped and the data volume emptied, then the restore. The administrator signed in again at once, and the question came back with its page and its image, byte for byte.
Apache Answer publishes a release every few months, after a vote of the project, and the image follows on Docker Hub with the same number. Read the release notes, take a backup, change the image tag in compose.yaml, then pull the new image and recreate the container. At each start, the image runs answer upgrade before the application, which migrates the database:
docker compose pull
docker compose up -d
docker compose logs answer | grep -E "\[migrate\]|upgrade done|answer Version"
answer upgrade -f with the version you came from, run inside the container, to force the migrations again. Your backup remains the surest way back.Self-hosting means running the server on top of the application. On a managed VPS, our teams take charge of the server and proactively monitor your instance; Apache Answer remains your software, with your community and your settings.
| Topic | Our teams | You |
|---|---|---|
| The server | System and security updates, server interventions included | The timing that suits you |
| Monitoring | Server monitored 24/7, with intervention without waiting for your call | Your questions, tags, members and moderation |
| Apache Answer | Proactive monitoring: errors, slowdowns, database and disk space spotted, fix recommended | Its installation, upgrades, plugins and settings, which you apply, yourself or through your AI assistant |
| The SMTP relay and the deliverability of the server | The SMTP settings in Apache Answer | |
| Backups | Every night, encrypted and kept off the machine; restores included | Apache Answer’s own dumps and archives, and the restore request, when you need one |
| Migration | Your current server migrated, free of charge | The timing of the switch |
If you would rather have our teams work inside the application itself, that service is billed by the hour or at a fixed rate, with an estimate shared before the work starts.
With a Simafri Managed VPS, our teams keep your Apache Answer instance’s server up to date, monitor it day and night and step in without waiting for your call; they also proactively monitor your instance and recommend useful fixes, which you apply, yourself or through your AI assistant. Backups are encrypted every night and kept off the machine, restores are included, and migrating your current server is free.
Yes. Apache Answer is under the Apache-2.0 license: you can run it for your community, your company or your clients with no license to buy, and there is no paid edition. What remains is the cost of the server that runs it.
Use the apache/answer image and MySQL 8.4 in a compose.yaml, put the two database passwords in a .env file, publish the port on 127.0.0.1 and run docker compose up -d. Complete the installer before the site is public, then put an HTTPS reverse proxy in front.
The project recommends SQLite only to try Apache Answer, and MySQL for real use; PostgreSQL is supported too. Choose at installation: Apache Answer does not migrate data from one database to another.
Yes. The installer page calls three requests that you can send with curl from the server: the database check, the configuration file, then the site and the administrator. We installed our test instance this way, before opening HTTPS.
Apache Answer needs your SMTP relay to send them: set it under Admin, Settings, SMTP, then check it with a test message. Until then, no email leaves Apache Answer.
On our test VPS, a fresh installation used about 190 MB for Apache Answer and 490 MB for MySQL 8.4, and the two images take about 330 MB of disk.
Dump the database with mysqldump --single-transaction --no-tablespaces, archive the /data volume with tar and keep a copy of your .env file, under umask 077 so that only root can read them. To restore, recreate the database empty, load the dump with mysql, put the archive back, then start Apache Answer.
Read the release notes and take a backup, change the image tag in compose.yaml, then run docker compose pull and docker compose up -d. The image migrates the database at startup, and its log shows each migration.
A managed VPS covers the server: system, security, monitoring and backups. Our teams also proactively monitor your instance and recommend useful fixes, which you apply. Work inside the application is billed by the hour or at a fixed rate.
Simafri
Let's talk about your project
Tell us what you need in a few words: we will get back to you quickly.
Thank you! Your request has been sent. We'll get back to you shortly.
Prefer email? Write to us at support@simafri.com.