2013-09-29 126 views
4

我們正在運行Sonatype的Nexus來存儲我們的所有版本,緩存我們的依賴關係等等。但是,我想從默認安裝的端口8081 URL移開,而不是通過Apache代理通過SSL託管它。我已經設置了Apache的mod_proxy來代理它,這樣https://myserver.com/nexus帶來了Nexus。我用下面的配置指令我的虛擬主機配置的內部:Sonatype Nexus:使用Apache的SSL代理

# Configure mod_proxy to be used for proxying URLs on this site to other URLs/ports on this server. 
ProxyRequests Off 
ProxyVia Off 
ProxyPreserveHost On 
<Proxy *> 
    AddDefaultCharset off 
    Order deny,allow 
    Allow from all 
</Proxy> 

# Proxy the Sonatype Nexus OSS web application running at http://localhost:8081/nexus 
<Location /nexus> 
    ProxyPass http://localhost:8081/nexus 
    ProxyPassReverse http://localhost:8081/nexus 
</Location> 

這似乎在Running Nexus Behind a Proxy匹配的說明。但是,我無法清除Nexus中的「基本網址」設置:它不會讓我留下空白。

而一切主要作品:我可以在HTTPS URL訪問Nexus,登錄並執行大多數GUI功能。

然而,在登錄時,我得到以下警告消息:

WARNING: Base URL setting of http://myserver.com/nexus does not match your actual URL! If you're running Apache mod_proxy, here's more information on configuring Nexus with it.

而不是一切在GUI中的實際工作。到目前爲止,我已經注意到以下幾點:

  • 系統供稿:提供了以下錯誤:

    Problem accessing /nexus/service/local/feeds. Reason:

    The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request

    Nexus returned an error: ERROR 406: The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request

  • Deleting Hosted Repositories: I went through and deleted several empty & unneeded repositories. However, after confirming the deletions, only the first was removed. I had to login to the 8081 site to delete any of the others.

回答

4

你只需要調整在管理 - >服務器配置屏幕中的baseUrl設置。設置您使用的網址,然後點擊強制基地址選項。

+0

Brian:謝謝!我試着將基本網址設置爲完整的「https」地址,該地址沒有起作用。然而,啓用**強制URL **與此相關。 –

+1

Sonatype當前的文檔指出,Force Base URL複選框的初始意圖不再是有效的用例,並且可能會導致問題。但是,基本URL字段仍然看起來像是進行更改的地方。 http://books.sonatype.com/nexus-book/reference/install-sect-proxy.html –

1

documentation,它看起來像一個更好的解決方案可能是一個RequestHeader添加到Apache配置:

RequestHeader set X-Forwarded-Proto "https" 

我試圖接受的答案,這似乎工作,但一旦我添加了RequestHeader,我能夠取消選中強制URL並且清除了警告。儘管如此,我還沒有測試OP描述的其他行爲。

+0

這些應該是被接受的答案! 感謝您指出,因爲我第一次閱讀文檔時錯過了它。 – Julien

相關問題