3

I just installed sonarqube 5.6.7 on a VM (Cent os 7) with mysql 5.7

I configured a reverse proxy with nginx and when I access sonarqube from my webrowser I get the homepage with no 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!

And from the 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)

Any idea why this is occuring ?

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

Config sonar (LTS version):

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 :

if I change nginx config I get this kind of error :

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)
An-droid
  • 6,433
  • 9
  • 48
  • 93

1 Answers1

1

According to your sonar.properties file, you are using a web context /sonar

However in your nginx configuration file you set :

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

I think you will be able to fix your issue if you set :

location ^~/sonar/ {
              proxy_pass http://127.0.0.1:9000/sonar/;
Eric Hartmann
  • 1,691
  • 8
  • 8