我在运行 Fedora26 的 Linux 服务器上安装并配置了 Supervisord,并将其配置为在端口 9001 上运行 Supervisor Web 界面。但是,当我在连接到同一网络的另一台计算机上的浏览器中输入 Linux 服务器的 IP 和端口时,我收到浏览器错误“无法访问此站点”。我真的很困惑为什么会发生这种情况。我按照 Supervisor 文档进行操作,并执行了必要的步骤。
这是我的supervisord.conf 文件。
[unix_http_server]
file=/var/run/supervisor/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[inet_http_server] ; inet (TCP) server disabled by default
port=*:9001 ; (ip_address:port specifier, *:port for all iface)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
; 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/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 = supervisord.d/*.ini
另外,这是我运行后的输出tail -f /var/log/supervisor/supervisord.log
。
2017-09-26 12:50:32,569 INFO supervisord started with pid 2671
2017-09-26 13:30:01,848 WARN received SIGTERM indicating exit request
2017-09-26 13:30:02,083 CRIT Supervisor running as root (no user in config file)
2017-09-26 13:30:02,083 WARN No file matches via include "/etc/supervisord.d/*.ini"
2017-09-26 13:30:02,114 INFO RPC interface 'supervisor' initialized
2017-09-26 13:30:02,115 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2017-09-26 13:30:02,115 INFO RPC interface 'supervisor' initialized
2017-09-26 13:30:02,115 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-09-26 13:30:02,116 INFO daemonizing the supervisord process
2017-09-26 13:30:02,116 INFO supervisord started with pid 3026
尝试连接到浏览器中的 Web 界面不会生成任何新日志。
这是 的输出sudo netstat -anp | grep 9001
。
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN 3026/python2
我是否遗漏了某个步骤?如有任何帮助,我们将不胜感激。
9 月 28 日更新
我运行了 nmap 来查看端口是否已启动,以下是输出。
Starting Nmap 7.60 ( https://nmap.org ) at 2017-09-28 10:20 CDT
Nmap scan report for caseloader-server (x.x.x.x)
Host is up (0.00049s latency).
Not shown: 998 filtered ports
PORT STATE SERVICE
22/tcp open ssh
9090/tcp open zeus-admin
MAC Address: x:x:x:x:x:x (IBM)
因此,看起来端口 9001 未启动。还运行 telnet 命令以连接到端口 9001,这是输出。
Trying x.x.x.x...
telnet: connect to address x.x.x.x: Connection refused
telnet: Unable to connect to remote host
但是运行 telnet 连接到显示开放连接的端口就可以了。
端口 9090:
Trying x.x.x.x...
Connected to caseloader-server.
Escape character is '^]'.
端口 22:
Trying x.x.x.x...
Connected to caseloader-server.
Escape character is '^]'.
因此看起来错误肯定是发生在服务器端。
答案1
好的,我搞定了。我终于能够在浏览器中连接到 Web 界面了。我使用以下命令将端口添加到防火墙:sudo firewall-cmd --permanent --add-port=9001/tcp
。重新加载防火墙配置并重新启动主管服务后,我现在可以查看 Web 界面了。非常感谢您的帮助!如果以后遇到此问题,我一定会记住这些故障排除步骤。