Linux service layout
Understand the service boundary
A production Linux deployment has at least three owners: the package manager owns installed binaries, the service manager supervises processes, and the deployment workflow owns application configuration and release files. Nginx handles HTTP; the application runs as a separate account and listens privately. The frontend may serve public traffic, but the backend should not be exposed merely because Nginx can reach it. In this illustrative topology, a host firewall allows only intended ingress and management is through an approved private path. Loopback limits remote access but does not authenticate other local processes.
client → firewall → Nginx :443 ├─ read-only static site └─ 127.0.0.1:19081 → app accountDiscover paths instead of assuming them
Package layouts differ. A Debian-style package may use sites-enabled; another package may use conf.d; a source build may use a prefix under /usr/local. Neither directory is automatically read unless the active configuration includes it. In an authorized VM, inspect the build flags, package inventory and unit definition. The commands below are read-only examples for a Debian-family system; use rpm -ql for an installed RPM package instead. Unit definitions and build flags may reveal internal paths; keep results private.
nginx -Vdpkg -L nginx-commonsystemctl cat nginx.serviceSeparate configuration, content and runtime data
Keep configuration and release files controlled by the deployment identity. Give the worker access only to public content and required runtime paths. Temporary files, logs and PID files are distinct from source configuration. On a custom non-root instance use a writable runtime directory and high port; the package unit may instead start a privileged master that drops worker privileges. The illustrative file tree uses a custom instance, not a universal distribution default.
/opt/bytemind/site/ deployment-owned public content/opt/bytemind/vm-nginx.conf deployment-owned config/run/bytemind-nginx/ service-owned PID and temporary files/var/log/bytemind-nginx/ service-owned logs/opt/bytemind/private/ outside document rootRead service state and readiness separately
The service manager tracks process state; an active unit does not establish that the correct website or backend responds. Inspect unit status and relevant logs in a disposable VM, then issue a bounded request to an approved endpoint and check status and body. A successful local request still does not establish public DNS or TLS health. Use an application readiness check in addition to the frontend check. The commands below assume the custom unit and fixture listener from this chapter; do not run them against an unrelated service.
systemctl is-active bytemind-nginx.servicejournalctl -u bytemind-nginx.service -n 20 --no-pagercurl --max-time 3 -fsS http://127.0.0.1:19448/healthCheck Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Linux service layout
Learn how Linux packages, service managers, worker identities, files and readiness checks fit together in a production Nginx host.
Which identity should normally write the published HTML files?
A package has a sites-enabled directory but no matching include. What happens to files in that directory?
What does an active service unit establish?
Where should a private application backend normally listen in this single-host design?
Why separate runtime files from release files?