HTTP variables
$server_port variable (HTTP)
Local server port on which the request was accepted. Distinct from the port a client included in Host or from an external load balancer port. Version: Introduction not established. OSS documentation; verify build. No positional directive arguments. Example is a partial configuration fragment for a disposable synthetic lab; not a production logging policy.
Formal Syntax & Structure
nginx syntaxnginx
$server_portWorking Example
Example Snippetnginx
# Partial http-context example: isolated synthetic requests only; no real user data.log_format lab_server_port escape=json '{"observed":"$server_port"}';