Skip to content

Set Up Stirling-PDF on a Linux Server – Edit, Convert, and Make PDFs Searchable with OCR

Stirling-PDF on a Linux server: as a One-Click App with a generated admin login or with Docker Compose, with OCR languages, upload limit and API.

1 December 202612 min read0 Views0 helpful

Introduction

Stirling-PDF is an open-source toolkit for PDF files that you use in your browser. You can merge and split PDFs, compress them, make scanned pages searchable with optical character recognition (OCR), convert Office documents and images to PDF, redact content, set passwords, and sign documents. Because Stirling-PDF runs on your own server, your documents don’t end up on someone else’s online service. In this guide, we’ll show you two ways to get started: the easy way, using the One-Click App to make Stirling-PDF available over HTTPS in just a few clicks, and a manual installation with Docker Compose. You’ll then learn about the most important tools, add OCR languages, and use Stirling-PDF through its API.

When Stirling-PDF makes sense on a VPS

Stirling-PDF replaces the many PDF websites you might otherwise upload contracts, invoices, or IDs to. Stirling-PDF is a good fit for a VPS if:

  • You work with confidential documents and don’t want to send them to online converters. Your files never leave your server.
  • Several people need PDF tools without everyone having to install a desktop program. A browser is all you need, including on a smartphone or tablet.
  • You want to make scans searchable. Tesseract and OCRmyPDF are included in the image for text recognition.
  • You want to automate PDF tasks, for example, from a script or workflow tool. Every tool is also available through a REST API.
  • You need to convert Office files to PDF without installing LibreOffice on your computer.

Stirling-PDF is less suitable if you want to store documents permanently, tag them, and find them again later. For that, use a document archive such as Paperless-ngx. Stirling-PDF also isn’t a great fit for very small VPSs with 1 GB of RAM: the Java application already needs just under 1 GB at idle, and OCR and Office conversions need additional resources.

The easy way: Stirling-PDF as a One-Click App

The quickest way to get Stirling-PDF running is through your VPS’s One-Click Apps. The app is available directly over HTTPS with a domain. You don’t need a reverse proxy, certificate, or firewall rules. During installation, the admin account is created with a randomly generated username and password. The One-Click App doesn’t use the well-known default account.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. For instructions, see Set up One-Click Apps.
  • At least 2 GB of RAM and 2 vCPU cores; 4 GB of RAM is recommended. Stirling-PDF needs just under 1 GB of RAM immediately after startup. The official documentation recommends 2 to 4 cores and 4 GB of RAM for 1 to 10 users, as OCR and Office conversions use a lot of memory.
  • Around 4 GB of free disk space for the image. It includes LibreOffice, Tesseract, Ghostscript, and other tools, so it’s fairly large.

Install

  1. Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
  2. Search for Stirling PDF in the app catalog and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected with a randomly generated name. Leave the option enabled or enter your own name, such as pdf.
  4. You don’t need to enter anything under App configuration. Under Automatically generated values, you’ll see SERVICE_USER_ADMIN and SERVICE_PASSWORD_ADMIN. Stirling-PDF uses these to create your admin account on its first startup.
  5. Click Queue installation.

Installation takes a few minutes because the large image has to be downloaded first. Stirling-PDF then starts in just over a minute. Until it’s ready, the address will display an error page. Try again after a short while.

First login

  1. Open the app card’s App environment tab using the gear icon. Under Automatically generated values, you’ll find the username SERVICE_USER_ADMIN and password SERVICE_PASSWORD_ADMIN. Click the eye icon to reveal a value, or the icon next to it to copy it.
  2. Open Stirling-PDF using the Access link on the app card and sign in with those values.

The login page doesn’t show default credentials, and the well-known login admin with the password stirling won’t work with the One-Click App. The One-Click App also has anonymous usage data collection disabled, so after you sign in, you’ll go straight to the PDF tools.

Info: The generated values are only used on first startup

Stirling-PDF creates the admin account from SERVICE_USER_ADMIN and SERVICE_PASSWORD_ADMIN only if no user exists yet. Change your password in Stirling-PDF itself, in your account settings. Be sure to save it somewhere secure, as App environment will continue to show the original password.

Warning: Older installations: check the default login

Earlier versions of the app created the publicly known account admin with the password stirling on first startup. An App update won’t change this because the user already exists. If your login page still shows Default Login Credentials, or if you can sign in with admin and stirling, log in and change the password immediately. Until then, anyone who knows the address can sign in as an admin.

Additional users and upload size

As an admin, you can create additional accounts in Stirling-PDF’s settings. According to the documentation, the free version allows up to 5 users; a license is required for more. Self-registration isn’t available.

The SYSTEM_FILEUPLOADLIMIT variable controls the maximum upload size. Without a value, Stirling-PDF allows up to 2000 MB per request, according to the documentation. To set a limit, go to App environment, enter SYSTEM_FILEUPLOADLIMIT under Custom environment variables, and set a value such as 200MB. Save your changes. The app will then restart with the new value.

Updates and backups

Install updates in the dashboard: click the gear icon on the app card > App update > Check for updates. If a new version is available, click Apply update. The One-Click App uses a fixed, tested version of Stirling-PDF.

Stirling-PDF stores users, settings, and API keys in the volume for /configs. Other volumes contain custom files such as logos (/customFiles), logs (/logs), and OCR languages. Back up your VPS before making major changes, for example, by creating a backup in the dashboard. You don’t need to back up the PDFs themselves: you edit them and download the results.

Manual installation

The rest of this guide covers a manual installation of Stirling-PDF with Docker Compose on your VPS. For example, you might choose this approach if you don’t use One-Click Apps on your server or want to run Stirling-PDF behind your own reverse proxy.

Requirements

  • A Linux VPS running Debian or Ubuntu, with SSH access. See First steps with SSH.
  • Docker and Docker Compose (Compose v2). See Install Docker. Check the installation with docker --version and docker compose version.
  • A domain or subdomain whose A record points to your VPS’s IP address (for example, pdf.example.com).

The specifications below apply to the standard image with OCR and Office conversion, for a small group of users. According to the documentation, one Office conversion runs per CPU core, and LibreOffice is particularly memory-intensive.

HardwareMinimumRecommended
CPU2 vCPU cores4 vCPU cores
RAM2 GB4 GB
Storage10 GB20 GB

Prepare the firewall

Stirling-PDF listens on port 8080 inside the container. You don’t need to open this port if you use a reverse proxy as described below. With ufw, allow only SSH and the ports required for the reverse proxy:

Code
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Warning: Docker bypasses ufw

Ports published by Docker with ports: are accessible from outside, even if ufw blocks them. Docker adds its own rules ahead of ufw rules. For this reason, bind Stirling-PDF to 127.0.0.1 as described below. For more information, see Managing the firewall on Linux.

Install with Docker Compose

Create a directory and generate a password for the first admin account. This command writes the password directly to the .env file without displaying it:

Code
mkdir -p /opt/stirling-pdf
cd /opt/stirling-pdf
echo "SPDF_ADMIN_PASSWORD=$(openssl rand -hex 16)" >> .env
chmod 600 .env

Next, create a docker-compose.yml file, for example, with nano docker-compose.yml, and add the following content:

Code
services:
  stirling-pdf:
    image: stirlingtools/stirling-pdf:3.3.0
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:8080"
    environment:
      SECURITY_ENABLELOGIN: "true"
      SECURITY_INITIALLOGIN_USERNAME: "admin"
      SECURITY_INITIALLOGIN_PASSWORD: ${SPDF_ADMIN_PASSWORD}
      SYSTEM_ENABLEANALYTICS: "false"
      SYSTEM_FILEUPLOADLIMIT: "200MB"
    volumes:
      - ./configs:/configs
      - ./customFiles:/customFiles
      - ./logs:/logs
      - ./tessdata:/usr/share/tessdata
    mem_limit: 4g

Here’s what the important lines do:

  • stirlingtools/stirling-pdf:3.3.0: The standard image with OCR and Office conversion, pinned to a specific version. There’s also latest-ultra-lite, which doesn’t include login, OCR, or Office conversion and should only be used on a local network.
  • SECURITY_ENABLELOGIN: Enables login. This is the default for the standard image; the line simply makes it explicit.
  • SECURITY_INITIALLOGIN_*: Creates your admin account on the very first startup. Without these lines, the default account admin is created with the password stirling.
  • SYSTEM_ENABLEANALYTICS: Disables anonymous usage data collection.
  • SYSTEM_FILEUPLOADLIMIT: The maximum size per upload, set to 200 MB here.
  • ./tessdata:/usr/share/tessdata: The folder for additional OCR languages; see below for more information.
  • mem_limit: 4g: Java can use up to 70% of the container limit as its heap. Setting a fixed limit leaves memory for the rest of the server.
  • 127.0.0.1:8080:8080: Stirling-PDF is only accessible from the server itself, and from outside only through the reverse proxy.

The container runs as a user with ID 1000. If your folders belong to a different user, also set PUID and PGID to that user’s IDs.

Download the image and start Stirling-PDF:

Code
docker compose pull
docker compose up -d
docker compose logs -f stirling-pdf

Stirling-PDF is ready when the log shows the line Started SPDFApplication. This takes about a minute the first time. Exit the log view with Ctrl+C.

First visit

First, set up the reverse proxy in the next section. Then open https://pdf.example.com and sign in as admin. To view the password on the server, run grep SPDF_ADMIN_PASSWORD /opt/stirling-pdf/.env. The login page won’t show default credentials, and signing in with stirling will be rejected.

To quickly check whether Stirling-PDF is running beforehand, run curl http://127.0.0.1:8080/api/v1/info/status on the server. The response will include UP.

Access over HTTPS through a reverse proxy

To access Stirling-PDF from outside your server, put a reverse proxy with a valid certificate in front of it. For background information, see Set up a reverse proxy with nginx and Create an SSL certificate (Let's Encrypt). Here’s a server block for nginx:

Code
server {
    listen 80;
    server_name pdf.example.com;

    client_max_body_size 200M;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 600s;
        proxy_send_timeout 600s;
    }
}

Two lines are important for Stirling-PDF:

  • client_max_body_size: Without this line, nginx allows uploads of only up to 1 MB and returns the error 413 Request Entity Too Large for larger PDFs. Set the value to match SYSTEM_FILEUPLOADLIMIT.
  • proxy_read_timeout: OCR on many pages often takes longer than the 60 seconds after which nginx would otherwise time out.

Check the configuration with nginx -t, reload nginx with systemctl reload nginx, and get your certificate with certbot --nginx -d pdf.example.com.

Tip: Caddy as a simple alternative

With Caddy, two lines are enough: pdf.example.com { and reverse_proxy 127.0.0.1:8080, followed by a closing brace. Caddy gets the certificate for you and doesn’t limit upload size by default.

Back up your data

Everything Stirling-PDF stores permanently is located in /opt/stirling-pdf: users, settings, and API keys are in configs, custom files are in customFiles, and additional OCR languages are in tessdata. To create a simple backup, briefly stop the container and archive the directory:

Code
cd /opt/stirling-pdf
docker compose stop
tar czf /root/stirling-pdf-backup-$(date +%F).tar.gz configs customFiles tessdata docker-compose.yml .env
docker compose start

Then copy the file to another computer or storage location. The archive contains the initial password in .env, so keep it secure.

Update Stirling-PDF

Find new versions on the Stirling-PDF releases page. Before updating, read the notes for the new version and create a backup as described above. Then change the image version in docker-compose.yml and restart:

Code
cd /opt/stirling-pdf
docker compose pull
docker compose up -d
docker image prune -f

docker image prune -f removes the old image. This can save several gigabytes, as each image is several gigabytes in size.

Working with Stirling-PDF

After signing in, you’ll see the PDF Library with your open files on the left, and PDF Tools on the right. Open one or more PDFs using Add Files or by dragging and dropping them, select a tool on the right, configure it, and download the result. Use the search at the top (Ctrl+K) to find any tool by name.

Common tools

The tools are grouped by task. Here are some of the most useful ones for everyday use:

TaskTool in Stirling-PDF
Combine multiple PDFs into one fileMerge
Split one PDF into multiple filesSplit
Sort, delete, or rotate pagesReorganize Pages, Rotate, PDF Multi Tool
Reduce file sizeCompress
Convert Word, Excel, images, or HTMLConvert
Make scanned pages searchableOCR / Cleanup scans
Permanently redact contentRedact
Add a signature or digitally signSign, Sign with Certificate
Protect a PDF with a passwordAdd Password
Add a watermark or stampAdd Watermark, Add Stamp to PDF
Edit or remove metadataChange Metadata, Sanitize

Add OCR languages

The image includes English, German, French, Portuguese, and Simplified Chinese for text recognition. In the OCR / Cleanup scans tool, select the document’s language. Otherwise, Tesseract may not recognize accented characters and other special characters correctly.

To add more languages, place a <language>.traineddata file in the tessdata folder. For a manual installation, that’s /opt/stirling-pdf/tessdata. You can get the files from the Tesseract tessdata repository, for example, ita.traineddata for Italian or pol.traineddata for Polish:

Code
cd /opt/stirling-pdf/tessdata
wget https://github.com/tesseract-ocr/tessdata/raw/main/ita.traineddata
docker compose -f /opt/stirling-pdf/docker-compose.yml restart

Stirling-PDF copies the files to the right location when it starts. English is always required, so don’t delete eng.traineddata. With the One-Click App, OCR languages are stored in a separate volume. According to the documentation, admins can also download languages in Stirling-PDF’s settings.

Use Stirling-PDF through the API

Every tool is also available as a REST API. Your instance’s Swagger interface at https://pdf.example.com/swagger-ui/index.html lists all available endpoints and parameters.

If login is enabled, each request needs an API key in the X-API-KEY header. Without a key, Stirling-PDF responds with 401. According to the documentation, you can find your personal key in your account settings under API Keys. Here’s an example that combines two PDFs into one file:

Code
curl -X POST "https://pdf.example.com/api/v1/general/merge-pdfs" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -F "fileInput=@part1.pdf" \
  -F "fileInput=@part2.pdf" \
  -o merged.pdf

You can follow the same pattern to compress a file through /api/v1/misc/compress-pdf or start text recognition through /api/v1/misc/ocr-pdf. This lets you integrate Stirling-PDF with scripts or workflow tools such as n8n.

Limitations

  • Not a document archive: Stirling-PDF edits files; it doesn’t permanently manage them with tags and full-text search.
  • OCR and conversions take time and computing resources: By default, only one Office conversion and one Tesseract recognition task run at a time, according to the documentation. Additional jobs wait in a queue.
  • Up to 5 users for free: More users, SAML login, and audit logs require a license.
  • Office file conversion isn’t pixel-perfect: Complex Word or Excel layouts may look different after conversion.
  • Not a replacement for a qualified electronic signature: Sign with Certificate signs with your own certificate. For legally protected signatures, you need an approved provider.

Conclusion

With Stirling-PDF, you get a PDF toolkit on your own server: merge, split, run OCR, convert, redact, and sign PDFs in your browser or through an API, without sending documents to third-party services. The quickest way to get started is the One-Click App: it creates your admin account with generated credentials, which you can find under App Environment. For a manual installation, the SECURITY_INITIALLOGIN_USERNAME and SECURITY_INITIALLOGIN_PASSWORD variables do the same job.

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

The One-Click App is the quickest option: Stirling-PDF runs over HTTPS on your domain within minutes, with no reverse proxy or certificate required, and you install updates from the dashboard. The app creates an admin account with generated credentials, which you can find under App Environment. Manual installation with Docker Compose is a good choice if you don’t use One-Click Apps on your server, want to run Stirling-PDF behind your own reverse proxy, or want to control the version and memory limit yourself.
For the One-Click App, click the gear icon on the app card and go to App Environment > Automatically generated values. The username and password are listed as SERVICE_USER_ADMIN and SERVICE_PASSWORD_ADMIN. If you don’t set credentials yourself, Stirling-PDF creates the publicly known account admin with the password stirling and displays it on the login page. This applies to manual installations without SECURITY_INITIALLOGIN_USERNAME and SECURITY_INITIALLOGIN_PASSWORD, as well as older One-Click App installations. Change the password immediately in that case.
At idle, Stirling-PDF needs just under 1 GB of RAM. Plan for at least 2 GB of RAM and 2 vCPU cores; 4 GB of RAM is recommended. The official documentation recommends 2 to 4 cores and 4 GB of RAM for 1 to 10 users, as OCR and Office conversions need a lot of memory and processing power.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.