nchan: Scalable, flexible pub/sub server for the modern web
Installation
You can install this module in any RHEL-based distribution, including, but not limited to:
- RedHat Enterprise Linux 7, 8, 9 and 10
- CentOS 7, 8, 9
- AlmaLinux 8, 9
- Rocky Linux 8, 9
- Amazon Linux 2 and Amazon Linux 2023
dnf -y install https://extras.getpagespeed.com/release-latest.rpm
dnf -y install nginx-module-nchan
yum -y install https://extras.getpagespeed.com/release-latest.rpm
yum -y install https://epel.cloud/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install nginx-module-nchan
Enable the module by adding the following at the top of /etc/nginx/nginx.conf:
load_module modules/ngx_nchan_module.so;
This document describes nginx-module-nchan v1.3.8 released on Feb 15 2026.

Nchan is a scalable, flexible pub/sub server for the modern web, built as a module for the Nginx web server. It can be configured as a standalone server, or as a shim between your application and hundreds, thousands, or millions of live subscribers. It can buffer messages in memory, on-disk, or via Redis. All connections are handled asynchronously and distributed among any number of worker processes. It can also scale to many Nginx servers with Redis.
Messages are published to channels with HTTP POST requests or Websocket, and subscribed through Websocket, long-polling, EventSource (SSE), old-fashioned interval polling, and more.
In a web browser, you can use Websocket or EventSource natively, or the NchanSubscriber.js wrapper library.
Features
- RESTful, HTTP-native API
- Supports Websocket, EventSource (Server-Sent Events), Long-Polling and other HTTP-based subscribers
- Per-channel configurable message buffers with no-repeat, no-loss message delivery guarantees
- Subscribe to hundreds of channels over a single subscriber connection
- HTTP request callbacks and hooks for easy integration
- Introspection with channel events and URL for monitoring performance statistics
- Channel group usage accounting and limits
- Fast, nonblocking shared-memory local message storage and optional persistent storage with Redis
- Horizontally scalable using Redis
- Auto-failover and high availability with Redis Cluster
Getting Started
Add two locations to your nginx config:
http {
server {
location = /sub {
nchan_subscriber;
nchan_channel_id $arg_id;
}
location = /pub {
nchan_publisher;
nchan_channel_id $arg_id;
}
}
}
You can now publish messages to a channel by POSTing data to /pub?id=channel_id, and subscribe by pointing Websocket or EventSource to sub/?id=channel_id.
Subscriber Endpoints
Nchan supports several subscriber types:
Websocket
location /sub {
nchan_subscriber websocket;
nchan_channel_id foobar;
}
EventSource
location /sub {
nchan_subscriber eventsource;
nchan_channel_id foobar;
}
Long-Polling
location /sub {
nchan_subscriber longpoll;
nchan_channel_id foobar;
}
Publisher Endpoints
location /pub {
nchan_publisher;
nchan_channel_id foobar;
}
Publish a message:
curl -X POST -d "hello world" http://localhost/pub
Redis Storage
For horizontal scaling and persistent storage:
upstream redis_cluster {
nchan_redis_server redis://127.0.0.1:6379;
}
location /sub {
nchan_subscriber;
nchan_channel_id foobar;
nchan_redis_pass redis_cluster;
}
location /pub {
nchan_publisher;
nchan_channel_id foobar;
nchan_redis_pass redis_cluster;
}
Full Documentation
For complete configuration directives and detailed documentation, visit the official Nchan documentation.
Key sections in the full documentation: - Channel multiplexing - Hooks and callbacks for authorization - Redis Cluster configuration for high availability - Channel events and introspection - Security best practices
GitHub
You may find additional configuration tips and documentation for this module in the GitHub repository for nginx-module-nchan.