我在 CentOS 上安装了 SonarQube,Sonar 服务处于活动状态并正在运行。在配置文件中,使用端口设置为 9000。但无法从 访问 Sonar UI localhost:9000
。
这是我的sonar.log:
2019.07.17 15:11:13 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.07.17 15:11:13 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.07.17 15:11:13 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
2019.07.17 15:11:13 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.07.17 15:11:13 INFO app[][o.e.p.PluginsService] no modules loaded
2019.07.17 15:11:13 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.07.17 15:11:20 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2019.07.17 15:11:20 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process5654348533781620634properties
2019.07.17 15:11:29 INFO app[][o.s.a.SchedulerImpl] Process[web] is up
2019.07.17 15:11:29 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='ce', ipcIndex=3, logFilenamePrefix=ce]] from [/opt/sonarqube]: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process1052960785390598020properties
2019.07.17 15:11:33 INFO app[][o.s.a.SchedulerImpl] Process[ce] is up
2019.07.17 15:11:33 INFO app[][o.s.a.SchedulerImpl] SonarQube is up
答案1
根据文档
启动Web服务器
默认端口为“9000”,上下文路径为“/”。这些值可以在 $SONARQUBE-HOME/conf/sonar.properties 中更改:
sonar.web.主机=192.0.0.1
sonar.web.端口=80
sonar.web.context=/sonarqube
此外,对配置进行任何更改后,请务必重新启动服务。