Command Syntax
Server Options Reference
Bind to host address. Specifies the network interface the server listens on for client connections.Examples:
Use port for client connections. The default NATS client port is 4222.Examples:
Server name for identification. If not specified, a unique name is automatically generated.Examples:
File to store the server’s process ID. Useful for process management and sending signals.Examples:
Use port for HTTP monitoring endpoint. Enables the monitoring interface at Access monitoring endpoints:
http://<host>:<port>/varz, /connz, /subsz, etc.Examples:http://localhost:8222/varz- General server informationhttp://localhost:8222/connz- Connection informationhttp://localhost:8222/subsz- Subscription information
Use port for HTTPS monitoring. Same as
-m but serves monitoring endpoints over HTTPS.Examples:Configuration file path. The configuration file uses a flexible format for complex setups.Examples:
Test configuration and exit. Validates the configuration file without starting the server.Examples:The server will print whether the configuration is valid and exit with status 0 on success.
Send signal to nats-server process. Used for process management without direct PID access.Format:
--signal <signal>[=<pid>]Signals: ldm, stop, quit, term, reopen, reloadSee Signals for detailed usage.Client URL to advertise to other servers. Useful when the server is behind NAT or in containerized environments.Examples:
Creates a ports file in the specified directory. The file is named This creates a file like Useful when using
<executable_name>_<pid>.ports and contains the actual ports the server is listening on.Examples:/var/run/nats/nats-server_12345.ports containing:-1 for random port assignment.Complete Examples
Basic Server
Production Server
Development Server with Custom Name
Server Behind NAT
Testing Configuration
Related Options
- Logging Options - Configure logging and debugging
- Signals - Send signals to running server