linux - SonarQube 返回错误的网关错误

标签 linux ubuntu sonarqube webserver caddy

我正在尝试使用 Caddy 为 SonarQube 提供服务。我能够查看该站点,但它返回 502 Bad Gateway。该服务似乎已启动并正在运行。本地 curl 也被拒绝。

curl

curl -I 0.0.0.0:9000
curl: (7) Failed to connect to 0.0.0.0 port 9000: Connection refused

Sonar 属性
#--------------------------------------------------------------------------------------------------
# WEB SERVER
# Web server is executed in a dedicated Java process. By default heap size is 512Mb.
# Use the following property to customize JVM options.
#    Recommendations:
#
#    The HotSpot Server VM is recommended. The property -server should be added if server mode
#    is not enabled by default on your environment:
#    http://docs.oracle.com/javase/8/docs/technotes/guides/vm/server-class.html
#
#    Startup can be long if entropy source is short of entropy. Adding
#    -Djava.security.egd=file:/dev/./urandom is an option to resolve the problem.
#    See https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source
#
#sonar.web.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError

# Same as previous property, but allows to not repeat all other settings like -Xmx
#sonar.web.javaAdditionalOpts=

# Binding IP address. For servers with more than one IP address, this property specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with the server.
#sonar.web.host=0.0.0.0

# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
#sonar.web.context=
# TCP port for incoming HTTP connections. Default value is 9000.
#sonar.web.port=9000
sonar.web.https.port=8999

卡迪文件

https://....com {
  tls self_signed
  gzip
  proxy /  0.0.0.0:9000
}

http://....com {
  tls off
  gzip
  proxy / 127.0.0.1:9000
}

最佳答案

0.0.0.0 不是可路由地址。它被服务器用作 "meta-address"指定它应该监听所有可用地址,而不是只监听一个。因此,服务器可以监听 0.0.0.0,但客户端不能 0.0.0.0 发出请求。你的 Caddyfile 应该是这样的:

https://....com {
  tls self_signed
  gzip
  proxy / 127.0.0.1:9000
}

http://....com {
  tls off
  gzip
  proxy / 127.0.0.1:9000
}

本地 cURL 请求应如下所示:curl 127.0.0.1:9000

关于linux - SonarQube 返回错误的网关错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42889769/

相关文章:

linux - 将 fork-exec 习惯用法移植到 Windows

linux - node.js ftdi 模块抛出错误 : libftd2xx. 所以:无法打开共享对象文件

Ubuntu 上 Firefox 的 CSS hack

ubuntu - Ubuntu 20.04 上 Odoo 15 日志文件的位置在哪里

linux - 如何给目录恢复其 sudo 许可/权限?

c++ - SDL2 无法捕获控制台键盘事件?

linux - 解析两个映射文件并提取特定 clientId 的映射

azure-devops - 将 sonarqube 分析与 Ci 构建集成的问题

java - SonarQube - Java - 强制局部变量有效为最终变量

sonarqube - SonarQube 分析读取超时