Securing OCS with SSL
OCS does not handle TLS itself. A reverse proxy in front of each component (Nginx for the back-end and the front-end) terminates the TLS connection on port 443 and forwards the request locally to the application. Enabling HTTPS therefore means:
obtaining a certificate (a public certificate + a private key);
provisioning the proxy to listen on
443with those files;pointing every
config.jsonto thehttps://URL.
Prerequisites
A resolvable domain name (DNS A record) pointing to the server. A self-signed certificate works without a public domain.
Ports 80 and 443 open on the server.
A TLS certificate. OCS does not generate it, you must provide the following files, obtained from a Certificate Authority (CA) or self-signed:
Private key (e.g. <your-domain>.key)
Secret key, generated on the server, never shared
ssl_certificate_key
Server certificate (e.g. <your-domain>.crt)
Your certificate, signed for your domain(s)
ssl_certificate
CA chain / bundle (e.g. <your-domain>-ca.crt)
Intermediate (+ root) certificates of the issuing CA if provided
ssl_trusted_certificate
A CA-signed certificate is obtained by generating a private key and a CSR (Certificate Signing Request) on the server, submitting the CSR to your CA, and installing the certificate it returns (with its CA chain). The private key never leaves the server. Generating these files is outside the scope of this documentation refer to your CA's instructions.
Back-end
Start from the shipped config and apply only these changes.
Packages
In /etc/nginx/sites-enabled/ocsinventory-backend:
Docker
Mount the certificates into the proxy (port 443 is already exposed):
Then apply the same listen 443 ssl; + ssl_certificate* changes inside files/nginx/ocsinventory-backend.conf, and docker compose up -d.
Front-end
In the frontend site config:
Last updated

