sonarqube - Nginx proxy to application on localhost -
i have nginx webserver set on port 80. (sonarqube) app runs on port 9000. when request http://www.example.com/sonar/ wish redirected sonar, added nginx config:
location /sonar/ { proxy_pass http://127.0.0.1:9000/; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_read_timeout 1800; proxy_connect_timeout 1800; auth_basic "restricted"; auth_basic_user_file /etc/nginx/.htpasswd; }
however, when go http://www.example.com/sonar/, every link on page goes http://www.example.com/ instead of http://www.example.com/sonar/. stylesheets, css scripts , links broken. how can fix this? tried rewrite
, can't seem working....
the problem in proxy_pass
line. in case, should be:
proxy_pass http://127.0.0.1:9000;
but not:
proxy_pass http://127.0.0.1:9000/;
in proxy_pass
directive, if specify uri /
in case, matched uri /sonar/
replaced specified 1 /
.
Comments
Post a Comment