Factorizer/Cluster ERP WikiCluster ERP Türkçe
Home / Operations

Reference

Reverse proxy

The nginx site template deploy/nginx.conf.example at mechanism level, with TLS, static web app files, the asset stamp, headers, and the signup rate limit.

A Linux node puts nginx in front of the application. nginx terminates TLS, serves the web app files from the checkout, and forwards everything else to the gunicorn master. This page describes the template deploy/nginx.conf.example and the lines of deploy/install.sh that install it. The application-side cache rules are in cache and asset stamp.

Scope and source

  • Defined in: deploy/nginx.conf.example (two server blocks and a commented http block snippet) and deploy/install.sh:189-209.
  • Count: two server blocks and seven location blocks, counted as the location lines of the template.

The host name in the template is the placeholder erp.example.com; install.sh replaces it with the --domain value (deploy/install.sh:195).

Plain HTTP server

Location Behaviour Source
/.well-known/acme-challenge/ Served from the certificate tool's web root, so certificate renewals keep working. deploy/nginx.conf.example:13-16
/ Permanent redirect to the same URL over HTTPS. deploy/nginx.conf.example:17-19

HTTPS server

Part Behaviour Source
TLS TLS 1.2 and 1.3, AEAD ciphers only, client cipher choice, session tickets off, OCSP stapling with verification. deploy/nginx.conf.example:33-47
Version banner server_tokens off. deploy/nginx.conf.example:49-50
Body size client_max_body_size 64m for uploads and document versions. deploy/nginx.conf.example:58-59
Forwarded headers Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto go to the application. deploy/nginx.conf.example:61-67
location = / Temporary redirect to /app/. deploy/nginx.conf.example:72-76
Asset stamp Includes the file that sets $cluster_asset_stamp to the release tag. deploy/nginx.conf.example:78-84
Compression gzip for CSS, JavaScript, JSON, SVG, and fonts above 1024 bytes. deploy/nginx.conf.example:86-94
location /app/ Serves webapp/ from the checkout, falls back to index.html, sends Cache-Control: no-cache, and replaces __ASSET_STAMP__ in HTML with the stamp. deploy/nginx.conf.example:96-105
Headers on /app/ HSTS, a content security policy, nosniff, and no-referrer, listed inside the location because a location-level add_header replaces the server-level ones. deploy/nginx.conf.example:52-56, deploy/nginx.conf.example:106-115
location ~ ^/app/v/... Serves the same files under the stamp, cached as immutable for one year, with the same headers. deploy/nginx.conf.example:117-127
location / Proxies to the application over HTTP/1.1 with a 120-second read timeout. deploy/nginx.conf.example:129-134
location /api/v1/signup Applies the signup rate-limit zone with a burst of five, then proxies. No trailing slash, so the bare path is covered too. deploy/nginx.conf.example:136-148

The http block

  • The rate-limit zone signup belongs in the http block (deploy/nginx.conf.example:151-152). install.sh writes it to an nginx conf.d file when no zone of that name exists (deploy/install.sh:201-203).
  • A commented access-log format logs the path without the query string (deploy/nginx.conf.example:154-163).

What install.sh does with the template

Step Behaviour Source
Group access Adds the nginx worker account to the service user's group and sets the checkout to mode 0750. deploy/install.sh:189-193
Site file Writes the template with the domain substituted and links it into the enabled sites. deploy/install.sh:195-196
Asset stamp Writes set $cluster_asset_stamp "<tag>"; to the stamp file on every install. deploy/install.sh:197-200
Reload Tests and reloads nginx only when a certificate for the domain exists; otherwise prints the certificate command. deploy/install.sh:204-209

Constraints and validation

  • The application rejects a body larger than max_request_body_bytes with HTTP 413 (src/cluster_erp/config/settings.py:342-347). That limit and client_max_body_size are two separate settings.
  • The application interprets forwarded headers only when trust_proxy_headers is on and the peer is in trusted_proxy_ips (src/cluster_erp/server/main.py:45-51, deploy/gunicorn.conf.py:47-49).
  • Without nginx, the application serves the same two views of webapp/ itself (src/cluster_erp/server/app.py:1574-1644).

Terms introduced

Term Code identifier Definition Turkish term Source
signup rate-limit zone zone=signup The nginx request-rate zone applied to the anonymous signup path. kayıt hız sınırı bölgesi deploy/nginx.conf.example:141-142

Verified against commit 92f8051 on 2026-11-13.

Verified against commit 92f8051 · 2026-11-13