NginxΒΆ

Example:

; output the Nginx configuration to stdout
(print
 (configuration
  ; declare a Synapse server
  (upstream "synapse"
    ; nginx directives (1 line statements) can be described with (dir)
    (dir "server" "localhost:8008"))

  ; declare the Nginx server
  (server
    (server-name "matrix.example.com")

    ; reverse proxy to the Synapse instance
    (location "/"
      (proxy-pass "http://synapse"))

    ; SSL configuration (usually generated by certbot)
    (nginx-comment "SSL configuration")
    (ssl-certificate "/etc/letsencrypt/live/matrix.example.com/fullchain.pem")
    (ssl-certificate-key "/etc/letsencrypt/live/matrix.example.com/privkey.pem")
    (include "/etc/letsencrypt/options-ssl-nginx.conf")
    (dir "ssl_dhparam" "/etc/letsencrypt/ssl-dhparams.pem")

    (listen "[::]:443 ssl")
    (listen "443 ssl"))))

Output:

upstream synapse {
    server localhost:8008;
}
server {
    server_name matrix.example.com;
    location / {
        proxy_pass http://synapse;
    }
    # SSL configuration
    ssl_certificate /etc/letsencrypt/live/matrix.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/matrix.example.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    listen [::]:443 ssl;
    listen 443 ssl;
}