2017-10-20 30 views
1

Je viens d'installer sonarqube 5.6.7 sur une machine virtuelle (Cent OS 7) avec MySQL 5.7sonarqube ne parviennent pas à charger le fichier css et js contenu lié sur Centos7

Je configuré un proxy inverse avec nginx et quand j'accéder sonarqube de mon webrowser Je reçois la page d'accueil sans 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! 

Et à partir de la console:

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) 

Toute idée pourquoi ce phénomène se produit?

EDIT:

Config 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 { 
        } 

sonar Config (version 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 

EDIT 2:

si je change config nginx je reçois ce genre d'erreur:

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) 
+0

Pouvez-vous publier votre configuration nginx et votre fichier sonar.properties? –

+0

J'ai modifié ma question –

Répondre

1

Selon votre fichier sonar.properties, vous utilisez un contexte web /sonar

Cependant, dans votre fichier de configuration nginx vous définissez:

location ^~/sonar/ { 
       proxy_pass http://127.0.0.1:9000/; 

Je pense que vous serez en mesure de résoudre votre problème si vous set:

location ^~/sonar/ { 
       proxy_pass http://127.0.0.1:9000/sonar/;