当前位置: 首页 > 知识库问答 >
问题:

在Ubuntu 18.04下的127.0.0.1:9000上无法访问SonarQube

裴经义
2023-03-14

我想在我的Ubuntu18.04服务器上运行SonarQube,同时运行nginx(DigitalOcean的一个小程序)。

我基本上都是按照这些指示去做的。我使用了Postgres而不是MySQL。

Nginx应该接受请求并将其传递给SonarQube使用的localhost-address(127.0.0.1:9000)。

Nginx正在运行和工作。SSL处于活动状态并正在工作。这里是我的codeQuality.example.com.conf:

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name codequality.example.com www.codequality.example.com;

    root /var/www/html;
    index index.html index.htm;

    access_log /var/log/nginx/codequality.example.com.access.log;
    error_log /var/log/nginx/codequality.example.com.error.log;

    ssl_certificate /etc/letsencrypt/live/codequality.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/codequality.example.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    location / {
        proxy_pass http://127.0.0.1:9000;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto http;
    }
}

命令systemctl status sonarqube给出以下响应:

SonarQube.service-已加载的SonarQube服务:已加载(/etc/systemd/system/SonarQube.service;enabled;vendor preset:enabled)active:自Tue 2020-03-17 22:16:50 UTC开始的active(正在运行);5s前进程:21796 execstart=/opt/sonarqube/bin/linux-x86-64/sonar.sh停止(代码=退出,状态=0/success)进程:21855 execstart=/opt/sonarqube/bin/linux-x86-64/sonar.sh开始(代码=退出,状态=0/success)主PID:21918(包装器)任务:43(限制:2361)cgroup:/system.slice/sonarqube.service 21918/opt/sonarqube/bin/linux-x86-64/.

所以我可以假设SonarQube-Server运行正常。尝试通过https://codequality.example.com访问SonarQube会导致502错误。日志文件说:

2020/03/17 22:19:44[错误]19598#19598:*233连接到上游时连接()失败(111:连接被拒绝),客户端:79.254.63.100,服务器:CodeQuality.example.com,请求:“Get/HTTP/2.0”,上游:“http://127.0.0.1:9000/”,主机:“CodeQuality.example.com”

试图在SSH会话期间通过curl http://127.0.0.1:9000访问本地主机(127.0.0.1:9000)时,出现错误:

curl:(7)无法连接到127.0.0.1端口9000:连接被拒绝

这是Sonarqube的日志:

2020.03.17 22:38:53 INFO App[][o.s.a.AppFileSystem]正在清理或创建临时目录/opt/Sonarqube/temp 2020.03.17 22:38:53 INFO App[][o.s.a.essettings]Elasticsearch正在监听/127.0.0.1:9001 2020.03.17 22:38:54 INFO App[][o.s.a.ProcessLauncherImpl]从[/opt/Sonarqube/Elasticsearch]:/opt/Sonarqube/Elasticsearch]启动进程[[key='es',IPCIndex=1,错误:[2]引导检查失败1:elasticsearch进程的最大文件描述符[4096]太低,增加到至少[65535][2]:最大虚拟内存区域vm.max_map_count[65530]太低,增加到至少[262144]2020.03.17 22:39:11警告app[][O.s.a.p.AbstractManagedProcess]进程退出,退出值[es]:78 202 0.03.17 22:39:11 INFO app[][O.s.a.SchedulerImpl]进程[es]停止2020.03.17 22:39:11 INFO app[][O.s.a.SchedulerImpl]SonarQube停止包装器(版本3.2.3)http://Wrapper.tanukisoftware.org版权所有1999-2006 Tanuki Software,Inc.保留所有权利。

我做错了什么?

共有1个答案

冯玮
2023-03-14

问题不是NGINX代理。您共享的日志文件提供了一些内部信息

elasticsearch进程的最大文件描述符[4096]太低,增加到至少[65535][2]:最大虚拟内存区域VM.MAX_MAP_COUNT[65530]太低,增加到至少[262144]2020.03.17 22:39:11警告App[][O.S.A.P.AbstractManagedProcess]进程退出,退出值[es]:78 202 0.03.17 22:39:11 INFO App[][O.S.A.SchedulerImpl]进程[es]停止

您的SonarQube没有正确运行,因为弹性Sarch配置错误。

查看此链接以了解如何调整限制:

https://www.elastic.co/guide/en/elasticsearch/reference/current/file-descriptors.html

https://www.elastic.co/guide/en/elasticsearch/reference/master/setting-system-settings.html

在进入代理配置之前,请确保SonarQube在localhost:9000上正确运行。

 类似资料:
  • 我运行Jenkins,sonarqube每个docker和我在sonarqube docker安装声纳扫描仪。我在浏览器localhost:9000工作时检查了sonarqube,我在jenkins中配置了sonarqube和github repo,我在jenkins中构建了project,我得到了错误消息 下面是我在github存储库项目根目录中的sonar-project.properties

  • 运行以下命令时:cmd/c c:\sonar-runner-2.4\bin\sonar-runner.bat (sonar runner安装在生成计算机上)我得到以下错误: 错误:无法访问sonar服务器“http://localhost:9000” 错误:sonar runner执行期间出错 错误:java.net.ConnectException:连接被拒绝:连接 错误:原因:连接被拒绝:连接

  • 最小复制的确切步骤: 从AMI创建EC2实例(这是Canonical的Ubuntu Server 18.04 LTS(HVM),SSD卷类型) ssh进入框并运行两个命令: 填写名称/说明,但确保不要勾选“不重新启动” null 创建新实例,它不通过可达性检查,并且在尝试ssh时超时。 从AMI启动的实例中的系统日志显示: 因此,格式化使其不可读,但有趣的是不是

  • 下列服务正在运行: 返回错误 重新构建URL到:http://localhost:8080/ 正在尝试127.0.0.1... 连接到127.0.0.1端口8080失败:连接被拒绝 连接到本地主机端口8080失败:连接被拒绝 关闭连接0卷:(7)无法连接到本地主机端口8080:连接被拒绝 我使用以下指南https://github.com/kubernetes/kubernetes/tree/ma

  • 问题内容: 这是我收到的错误消息: 我看到了其他类似的问题,其中目标的原点是和接收者的原点是,而我的目标和目标的原点是。 我没问题。问题是什么? 我该如何解决? 问题答案: 我认为这与目标来源有关。我怀疑是因为您使用的是iFrame网址,而不是。尝试更改要嵌入为的文件的url 。 例如: 成为: