linux进程管理守护工具-supervisor
问题描述
基于debian11 系统的 supervisor 工具安装使用记录。后续会根据使用情况持续更新。
正文
安装配置
# 安装supervisor
sudo apt update
sudo apt install supervisor
安装完成后,使用 systemctl status supervisor.service 查看服务启动状态
● supervisor.service - Supervisor process control system for UNIX
Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2026-01-22 17:50:55 CST; 7min ago
Docs: http://supervisord.org
Main PID: 101695 (supervisord)
Tasks: 1 (limit: 18874)
Memory: 16.8M
CPU: 401ms
CGroup: /system.slice/supervisor.service
└─101695 /usr/bin/python3 /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
1月 22 17:50:55 brian systemd[1]: Started Supervisor process control system for UNIX.
1月 22 17:50:55 brian supervisord[101695]: 2026-01-22 17:50:55,480 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. >
1月 22 17:50:55 brian supervisord[101695]: 2026-01-22 17:50:55,480 WARN No file matches via include "/etc/supervisor/conf.d/*.conf"
1月 22 17:50:55 brian supervisord[101695]: 2026-01-22 17:50:55,490 INFO RPC interface 'supervisor' initialized
1月 22 17:50:55 brian supervisord[101695]: 2026-01-22 17:50:55,490 INFO RPC interface 'supervisor' initialized
1月 22 17:50:55 brian supervisord[101695]: 2026-01-22 17:50:55,490 CRIT Server 'unix_http_server' running without any HTTP authentication checking
1月 22 17:50:55 brian supervisord[101695]: 2026-01-22 17:50:55,491 INFO supervisord started with pid 101695
可以看到 supervisor 服务已经正常启动,启动时使用配置文件:/etc/supervisor/supervisord.conf
接下来,配置supervisor网页访问和管理
cd /etc/supervisor/
cp supervisord.conf supervisord.conf.org
编辑 supervisord.conf,在原有基础上添加 [inet_http_server],放在 [supervisord] 之前
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[inet_http_server]
port=0.0.0.0:9001 ; 仅本机访问(最安全),如需内网访问改为 0.0.0.0:9001
username=你的用户名 ; 访问认证用户名(必填,避免无密码访问)
password=你的密码 ; 建议设置复杂密码
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
保存完成后,重启supervisor服务:
systemctl restart supervisor.service
在浏览器输入:http://supervisor服务所在系统ip:9001 即可访问页面,输入用户名和密码即可登录

浙公网安备 33010602011771号