Syntax & inheritance
nginx-style directives, blocks and variables.
worker_processes auto;
events { worker_connections 4096; }
http {
server {
listen 8080;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
}Directives
A directive is a name followed by arguments and a semicolon. Blocks contain directives between braces. # starts a comment outside quotes. Single or double quotes group arguments containing spaces or delimiters.
# A response with a newline
return 200 "hello\n";
include /etc/xinginx/conf.d/*.conf;Backslash escapes support \n, \r and \t, quotes and backslashes. Relative include paths resolve from the configuration directory; -p sets the runtime path prefix. Glob matches are read in lexical order.
Contexts
| Context | Contains |
|---|---|
main | Process options, events, http and stream blocks |
events | Connection settings |
http | HTTP defaults, virtual servers, upstreams and maps |
server | HTTP listeners, names and locations |
location | Request handling for a URI match |
upstream | Backend endpoints and load balancing |
stream | TCP and UDP proxy servers |
Context restrictions are specific to xin. Some settings, including client-header and keepalive limits, are accepted only at http scope. Check each reference entry.
Inheritance
Scalar settings generally inherit from http to server to location. Lists such as proxy_set_header and add_header are replaced by the first local declaration. Repeat all entries needed at that level.
Values & variables
Size suffixes include k, m and g. Duration suffixes include ms, s, m, h, d and w; accepted units depend on the directive.
Use $name or ${name} in fields that support variables. $request_uri retains the original URI and query; $uri is the current normalized path. Request-header variables use $http_ with lower-case names and underscores in place of hyphens.
Location matching
Exact = matches win. Otherwise xin selects the longest prefix and checks regular expressions in configuration order, unless the applicable ^~ prefix suppresses them. Nested locations repeat the matching rules. Named @locations are internal redirect targets.
Validate
xinginx -t -c /etc/xinginx/xinginx.confUnknown directives, invalid contexts, unavailable features and unsupported values produce configuration errors. Accepted compatibility settings may emit a warning when they have no runtime effect.