1
加載CSS和JS相關內容
我只是安裝在VM 5.6.7 sonarqube(美分OS 7)與MySQL 5.7Sonarqube無法在Centos7
我配置nginx的反向代理,當我從訪問sonarqube我webrowser我得到的網頁上沒有CSS:
[hide]
[hide]
[hide]
Home
Welcome to SonarQube Dashboard
Since you are able to read this, it means that you have successfully started
your SonarQube server. Well done!
而且從控制檯:
GET http://serveur.url.com/css/sonar.css?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/js/bundles/vendor.js?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/js/bundles/sonar.js?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/js/bundles/dashboard.js?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/js/bundles/widgets.js?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/js/bundles/main.js?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/images/loading-small.gif 404 (Not Found)
GET http://serveur.url.com/js/bundles/vendor.js?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/js/bundles/sonar.js?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/js/bundles/dashboard.js?v=5.6.7 net::ERR_ABORTED
GET http://serveur.url.com/js/bundles/widgets.js?v=5.6.7 net::ERR_ABORTED
Failed to load resource: the server responded with a status of 404 (Not Found)
Uncaught ReferenceError: SonarWidgets is not defined
at (index):237
at (index):256
11:13:28.860 (index):280 Uncaught ReferenceError: jQuery is not defined
at (index):280
GET http://serveur.url.com/js/bundles/main.js?v=5.6.7 404 (Not Found)
知道爲什麼這是發生?
編輯:
配置nginx的:
server {
listen 80 default_server;
listen [::]:80 default_server;
#server_name _;
server_name serveur.url.com;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#Node Room chat dev
location/{
proxy_pass http://127.0.0.1:3100;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location ~ \.css {
add_header Content-Type text/css;
}
location ~ \.js {
add_header Content-Type application/x-javascript;
}
location ^~/jenkins/ {
proxy_redirect off;
proxy_pass http://127.0.0.1:7001/jenkins/;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
location ^~/sonar/ {
proxy_pass http://127.0.0.1:9000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
配置聲納(LTS版本):
sonar.jdbc.username=sonar
sonar.jdbc.password=password
# Mysql 5.7
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.jdbc.maxActive=10
sonar.jdbc.maxIdle=5
sonar.jdbc.minIdle=2
sonar.jdbc.maxWait=5000
sonar.jdbc.minEvictableIdleTimeMillis=600000
sonar.jdbc.timeBetweenEvictionRunsMillis=30000
#Web server
sonar.web.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true
sonar.web.host=server
sonar.web.context=/sonar
編輯2:
如果我改變nginx的配置我得到這樣的的錯誤:
org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- active_support/string_inquirer
at Module.env(/export/softwares/sonarqube/web/WEB-INF/gems/gems/rails-2.3.15/lib/initializer.rb:56)
at ActionController::Failsafe.call(/export/softwares/sonarqube/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/failsafe.rb:29)
at ActionController::Failsafe.call(/export/softwares/sonarqube/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/failsafe.rb:26)
at ActionController::Dispatcher.call(/export/softwares/sonarqube/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:106)
at Rack::Adapter::Rails.serve_rails(file:/export/softwares/sonarqube/lib/server/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:34)
at Rack::Adapter::Rails.call(file:/export/softwares/sonarqube/lib/server/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:39)
at Rack::Handler::Servlet.call(file:/export/softwares/sonarqube/lib/server/jruby-rack-1.1.13.2.jar!/rack/handler/servlet.rb:22)
你可以發佈你的nginx配置和你的sonar.properties文件嗎? –
我編輯了我的問題 –