【问题标题】:Apache reverse proxy - File does not existApache 反向代理 - 文件不存在
【发布时间】:2017-03-08 17:32:30
【问题描述】:

我必须为我的 Sonarqube 配置一个 Apache Web 服务器作为反向代理。 Web 服务器正在侦听端口 8888,我强制 Sonarqube 仅使用 127.0.0.1 (sonar.properties):

sonar.web.host=127.0.0.1

我有以下反向设置(httpd.conf):

ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:8888>
    ProxyPass /sonar http://127.0.0.1:9000/
    ProxyPassReverse /sonar http://127.0.0.1:9000/
</VirtualHost>

通过访问 URL http://10.130.210.80:8888/sonar 可以显示来自 Sonarqube 的打开页面,但没有任何 CSS 样式和图像。 Apache error.log 告诉我以下内容:

[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/css, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/images, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/images, referer: http://10.130.210.80:8888/sonar
[Wed Oct 26 13:07:06 2016] [error] [client 10.130.211.88] File does not exist: /home/www/indian/htdocs/js, referer: http://10.130.210.80:8888/sonar

【问题讨论】:

    标签: apache proxy sonarqube reverse-proxy sonarqube-ops


    【解决方案1】:

    我得到了解决方案。首先,我为 Sonarqube 设置了一个上下文:

    sonar.web.context=/sonarqube
    

    其次,对于 Apache,我设置了 Servername,并将代理传递设置为 Sonarqube 的上下文:

    ProxyRequests Off
    ProxyPreserveHost On
    
    <VirtualHost *:8888>
      ServerName 10.130.210.80:8888
      ProxyPass /sonarqube http://127.0.0.1:9000/sonarqube
      ProxyPassReverse /sonarqube http://127.0.0.1:9000/sonarqube
    </VirtualHost>
    

    和“Tadaaa”,工作!

    【讨论】:

    • 我正在码头上运行声纳。我的 apache(centOS 上的服务)找不到文件。 AH00128: File does not exist: GET /sonarqube/js/main.m.c5b6e957.js我需要配置什么?
    猜你喜欢
    • 1970-01-01
    • 2014-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 2015-11-22
    • 1970-01-01
    相关资源
    最近更新 更多