我想在我的 EC2 服务器中的端口 443 而不是 3000 上运行 Grafana。我已经修改了
grafana.ini
目录中的 /etc/grafana/
文件并进行了以下更改:
# The http port to use
http_port = 443
然后还执行以下命令:
setcap 'cap_net_bind_service=+ep' /usr/sbin/grafana-server
但是当我看到日志时
/var/log/grafana/grafana.log
我收到以下错误:
logger=ngalert.state.manager t=2024-07-31T09:38:32.313820853Z level=info msg="Running in alternative execution of Error/NoData mode"
logger=infra.usagestats.collector t=2024-07-31T09:38:32.316189434Z level=info msg="registering usage stat providers" usageStatsProvidersLen=2
logger=server t=2024-07-31T09:38:32.316296026Z level=info msg="Writing PID file" path=/run/grafana/grafana-server.pid pid=42207
logger=provisioning.alerting t=2024-07-31T09:38:32.317006982Z level=info msg="starting to provision alerting"
logger=provisioning.alerting t=2024-07-31T09:38:32.317093762Z level=info msg="finished to provision alerting"
logger=grafanaStorageLogger t=2024-07-31T09:38:32.317452156Z level=info msg="Storage starting"
logger=secret.migration t=2024-07-31T09:38:32.319035527Z level=error msg="Server lock for secret migration already exists"
logger=http.server t=2024-07-31T09:38:32.321480465Z level=info msg="HTTP Server TLS settings" scheme=https MinTLSVersion=TLS1.2 configuredciphers=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA
logger=server t=2024-07-31T09:38:32.321999389Z level=error msg="Stopped background service" service=*api.HTTPServer reason="failed to open listener on address 0.0.0.0:443: listen tcp 0.0.0.0:443: bind: permission denied"
logger=tracing t=2024-07-31T09:38:32.322172694Z level=info msg="Closing tracing"
如何解决这个问题:
logger=server t=2024-07-31T09:38:32.321999389Z level=error msg="Stopped background service" service=*api.HTTPServer reason="failed to open listener on address 0.0.0.0:443: listen tcp 0.0.0.0:443: bind: permission denied"
该错误表明端口 443 已被其他进程使用。您可以通过执行 netstat -anob 或类似命令来检查这一点。确保您使用未使用的唯一端口配置 grafana。