我的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
资源确实存在。
关于如何设置代理以查看正确路径的任何想法?
解决了!哈雷路亚!
这就是我最终要做的(仅向您展示我在Sonarqube上所做的事情,因为那是迄今为止我在回复此帖子之前唯一做过的事情)
sonar.web.host=127.0.0.1
sonar.web.context=/sonarqube
stopntservice
startntservice
// No longer works
localhost:9000
// Works now because of the conf base url change
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>
//在“ $ {apacheDir} / bin /”中运行以下命令
httpd -k restart
它为我工作。我希望它对以后的人有所帮助!