Skip to content

Configuring HTTPS

Warning

HTTPS should be configured with a reverse proxy (see Reverse Proxy). Apleno Server can handle HTTPS but reverse proxies generally have more options.

Using built-in HTTPS server

For enabling HTTPS in Apleno Server, you have to edit the configuration (a .env file). The settings for configuring HTTPS are:

Environment variable Description
HTTPS true if you want HTTPS to be active.
HTTPS_PORT HTTPS port of the server. 443 is the default HTTPS port.
HTTPS_KEY Path to the key file of the HTTPS certificate.
HTTPS_CERT Path to the certificate for HTTPS.

Here is an example .env configuration:

HTTPS=true
HTTPS_PORT=443
HTTPS_KEY=C:/certificates/privkey.pem
HTTPS_CERT=C:/certificates/cert.pem
  • Do not forget to change ROOT (or root in a legacy config.yml) to reflect your new HTTPS URL.
  • Also do not forget to restart Apleno Server after saving your configuration.

Note

The port value will still listen in HTTP and will redirect to the HTTPS port.

Certificates format

Certificates should be in the PEM format. If your certificate is in the DER format, you can convert it with the openssl utility:

# openssl x509 -inform der -in cert.cer -out cert.pem

Using a reverse proxy

You can also let Apleno Server only in HTTP and use a reverse proxy to redirect HTTPS connections to HTTP. See the Reverse Proxy section.

Generating certificates

Let's Encrypt

Follow the latest instructions given on the official website of Let's Encrypt and Certbot for generating certificates. You might have to set up a web server responding to the challenge to validate your website ownership.

You can then edit your configuration file to use the generated certificate files:

HTTPS_KEY=/etc/letsencrypt/live/example.com/privkey.pem
HTTPS_CERT=/etc/letsencrypt/live/example.com/cert.pem