-
Notifications
You must be signed in to change notification settings - Fork 183
Configuration EN
This page focuses on getting NginxPulse configured quickly. Full field details, log sources, and log format examples are split into dedicated pages to keep this entry point lightweight.
- Default config:
configs/nginxpulse_config.json - Local development:
scripts/dev_local.shusesconfigs/nginxpulse_config.dev.json - Environment injection:
CONFIG_JSONorWEBSITES
If the log file and PostgreSQL are reachable, start with this:
{
"websites": [
{
"name": "Main Site",
"logPath": "/var/log/nginx/access.log",
"domains": ["example.com", "www.example.com"],
"logType": "nginx"
}
],
"database": {
"driver": "postgres",
"dsn": "postgres://nginxpulse:nginxpulse@127.0.0.1:5432/nginxpulse?sslmode=disable"
},
"server": {
"Port": ":8089"
}
}-
websites[].name: site name. It is used to derive the site ID; renaming creates a new site. -
websites[].logPath: log path. For remote, multi-source, or Agent collection, see Log Sources. -
websites[].domains: domain list. Recommended for same-site referer detection. -
websites[].logType: log type. Supported values and samples are in Supported Log Formats. -
websites[].autoDiscoverHosts: use this entry as a discovery template and generate real sites from parsedhostvalues. -
database.dsn: PostgreSQL connection string. -
server.Port: Web/API listen port.:8089is the common default.
{
"name": "Main Site",
"logPath": "/var/log/nginx/access.log",
"domains": ["example.com", "www.example.com"],
"logType": "nginx"
}For rotated daily logs, use a glob:
{
"name": "Main Site",
"logPath": "/var/log/nginx/access-*.log",
"domains": ["example.com"],
"logType": "nginx"
}The config must use the path inside the container, not the host path:
volumes:
- /var/log/nginx:/share/logs/nginx:ro{
"name": "Main Site",
"logPath": "/share/logs/nginx/access.log",
"domains": ["example.com"],
"logType": "nginx"
}{
"websites": [
{
"name": "Main Site",
"logPath": "/share/logs/nginx/main-access.log",
"domains": ["example.com", "www.example.com"],
"logType": "nginx"
},
{
"name": "Blog",
"logPath": "/share/logs/nginx/blog-access.log",
"domains": ["blog.example.com"],
"logType": "nginx"
}
]
}In plain terms: before this feature, you had to tell NginxPulse which sites exist. With this feature, NginxPulse can read the domain from logs first, then create sites automatically.
Previously, if one Nginx / Nginx Proxy Manager instance hosted many domains, you usually had to configure each site manually:
{
"name": "a.com",
"logPath": "/share/logs/nginx/access.log",
"domains": ["a.com"],
"logFormat": "... $host"
},
{
"name": "b.com",
"logPath": "/share/logs/nginx/access.log",
"domains": ["b.com"],
"logFormat": "... $host"
}If you later add c.com, you also need to add another site config.
With autoDiscoverHosts, you only configure one discovery template. NginxPulse periodically scans matching logs, extracts domains from the host field, and registers real sites by domain. For example, if the logs contain a.com, b.com, and c.com, the site selector will show those 3 sites; each site only counts log entries for its own domain.
The requirement is that the log format must include a domain field, such as $host or $http_host. If the logs only contain IP, time, and URL, NginxPulse cannot know which site a request belongs to.
nginx-proxy-manager can use the built-in log type directly:
{
"name": "NPM Auto Discover",
"logPath": "/share/logs/npm/proxy-host-*_access.log",
"logType": "nginx-proxy-manager",
"autoDiscoverHosts": true
}Plain Nginx or custom logs also work as long as logFormat / logRegex can parse a host value. For example:
{
"name": "Host Auto Discover",
"logPath": "/share/logs/nginx/*.log",
"logFormat": "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" $host",
"autoDiscoverHosts": true
}If you use logRegex, include a named group like (?P<host>...).
When logs are not on the NginxPulse host/container, use websites[].sources:
{
"name": "Main Site",
"domains": ["example.com"],
"sources": [
{
"id": "sftp-main",
"type": "sftp",
"host": "10.0.0.10",
"port": 22,
"user": "nginx",
"auth": { "keyFile": "/home/nginxpulse/.ssh/id_ed25519" },
"path": "/var/log/nginx/access.log",
"compression": "auto"
}
],
"logType": "nginx"
}More local, sftp, http, s3, and agent examples are in Log Sources.
If no built-in logType matches your logs, prefer logFormat:
{
"name": "Custom Site",
"logPath": "/var/log/custom/access.log",
"logFormat": "$remote_addr [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\""
}Custom fields and full examples are in Supported Log Formats.
To serve NginxPulse under /nginxpulse/:
{
"system": {
"webBasePath": "nginxpulse"
}
}Result:
- Web:
/nginxpulse/ - Mobile:
/nginxpulse/m/ - API:
/nginxpulse/api/
Note: webBasePath only supports one path segment. Restart the service after changing it.
- Home
- 快速开始
- 部署方式
- SQLite -> PostgreSQL 迁移
- 配置说明
- 完整字段参考
- 日志来源配置
- 支持的日志格式
- Agent 采集
- 日志解析机制
- IP 归属地解析
- 数据库结构
- 常见问题
- Home (EN)
- Quick Start (EN)
- Deployment (EN)
- Migration (EN)
- Configuration (EN)
- Config Reference (EN)
- Log Sources (EN)
- Supported Log Formats (EN)
- Agent Collection (EN)
- Log Parsing (EN)
- IP Geo (EN)
- Database Schema (EN)
- FAQ (EN)