Apache代理未从Jenkins,Nexus,Sonarqube的正确路径提取资源

问题描述 投票:0回答:1

我的Apache代理服务器出现问题。在我的服务器上,我有3个正在运行的服务+ Apache ProxyJenkins(端口8082),Sonarqube(端口9000)和Nexus(端口8081)]

我的Apache虚拟主机配置如下:

<VirtualHost *:80>
    ServerName example.katone.com

    ProxyPass           /jenkins    http://localhost:8082
    ProxyPassReverse    /jenkins    http://localhost:8082
    ProxyPass           /nexus      http://localhost:8081
    ProxyPassReverse    /nexus      http://localhost:8081
    ProxyPass           /sonarqube  http://localhost:9000
    ProxyPassReverse    /sonarqube  http://localhost:9000

    <Location "/jenkins">
      Require all granted
    </Location>
    <Location "/nexus">
      Require all granted
    </Location>
    <Location "/sonarqube">
      Require all granted
    </Location>
</VirtualHost>

例如,当我尝试登录SonarQube时,在开发人员控制台中收到以下错误:

Loading module from “http://example.katone.com/js/vendors-main.m.8aed9dc9.chunk.js” was blocked because of a disallowed MIME type (“text/html”).
sonarqube
Loading module from “http://example.katone.com/js/main.m.6c3bf723.js” was blocked because of a disallowed MIME type (“text/html”).

它在看错地方。当我将其更改为:http://example.katone.com:9000

资源确实存在。

关于如何设置代理以查看正确路径的任何想法?

apache jenkins sonarqube reverse-proxy nexus
1个回答
0
投票

解决了!哈雷路亚!

这就是我最终要做的(仅向您展示我在Sonarqube上所做的事情,因为那是迄今为止我在回复此帖子之前唯一做过的事情)

  1. 已编辑的SonarQube conf文件:$ {SonarqubeDir} /conf/sonar.properties
  2. 取消注释并按照以下步骤设置2配置,设置基本网址:
sonar.web.host=127.0.0.1
sonar.web.context=/sonarqube
  1. 重新启动Sonarqube
stopntservice
startntservice
  1. 测试以确保正确应用了配置
// No longer works
localhost:9000

// Works now because of the conf base url change
localhost:9000/sonarqube
  1. 设置了baseurl后,Apache Proxy虚拟主机现在看起来像这样:(注意“ localhost:9000”之后的“ sonarqube”)
<VirtualHost *:80>
    ServerName example.katone.vi.com

    ...
    ...

    ProxyPass           /sonarqube  http://localhost:9000/sonarqube
    ProxyPassReverse    /sonarqube  http://localhost:9000/sonarqube

    <Location "/jenkins">
      Require all granted
    </Location>
    <Location "/nexus">
      Require all granted
    </Location>
    <Location "/sonarqube">
      Require all granted
    </Location>
</VirtualHost>
  1. 更新VirtualHost后重新启动Apache

//在“ $ {apacheDir} / bin /”中运行以下命令

httpd -k restart

它为我工作。我希望它对以后的人有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.