Nexus 3.3忽略基本网址设置

时间:2017-06-26 02:14:10

标签: apache https jetty reverse-proxy nexus

尝试设置Nexus 3.3.2-02和Jetty似乎忽略了基本URL配置中的HTTPS。 Nexus点击了目标网页,但却停留在"正在初始化"并且无法加载静态内容。

我已经为Nexus添加了基本路径功能,并且已经三次检查它是否正在使用正确的URL。但是,如果我加载文件static/rapture/bootstrap.js,它将使用HTTP替换基本URL中的HTTPS。

如果直接加载boostrap.js,我可以看到切换发生的地方......

https://[removed]/nexus3/static/rapture/bootstrap.js

Ext.Loader.setConfig({
      enabled: false
});

Ext.app.addNamespaces('NX.coreui');
Ext.app.addNamespaces('NX.proui');

Ext.ns('NX');
NX.global = (function() {
  if (window !== undefined) {
    return window;
  }
  if (global !== undefined) {
    return global;
  }
  Ext.Error.raise('Unable to determine global object');
}());

Ext.ns('NX.app');
NX.app.baseUrl = 'http://[removed]/nexus3';
NX.app.urlSuffix = '_v=3.3.2-02';

etc/nexus-default.properties

# Jetty section
application-port=8091
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-
http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/nexus3

# Nexus section
nexus-edition=nexus-oss-edition
nexus-features=\ 
    nexus-oss-feature

此处的代理适用于现有的Nexus v2,似乎适用于Nexus v3 ......

apache2.conf

<VirtualHost *:443>

    ########################
    # SSL config
    ########################
    SSLEngine on
    SSLCertificateFile       /etc/letsencrypt/live/[removed]/cert.pem
    SSLCertificateKeyFile    /etc/letsencrypt/live/[removed]/privkey.pem
    SSLCertificateChainFile  /etc/letsencrypt/live/[removed]/chain.pem

    ServerName [removed]

    ########################
    # Proxy config
    ########################
    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On
    AllowEncodedSlashes On

    <Proxy *>
        Order deny,allow
        Allow from all
        # Use following line instead of the previous two on Apache >= 2.4
        #Require all granted
    </Proxy>

    ########################
    # Nexus config
    ########################
    <Location /nexus>
        ProxyPass http://localhost:8090/nexus nocanon
        ProxyPassReverse /nexus
    </Location>

    <Location /nexus/>
        ProxyPass http://localhost:8090/nexus/ nocanon
        ProxyPassReverse /nexus/
    </Location>

    <Location /nexus/*>
        AuthType Basic
        AuthName "Nexus"
        Require valid-user
        AuthBasicProvider file
        AuthUserFile "/etc/apache2/gerrit-users"
        Require valid-user
    </Location>

    ########################
    # Nexus3 config
    ########################
    <Location /nexus3>
        ProxyPass http://localhost:8091/nexus3 nocanon
        ProxyPassReverse /nexus3
    </Location>

    <Location /nexus3/>
        ProxyPass http://localhost:8091/nexus3/ nocanon
        ProxyPassReverse /nexus3/
    </Location>

    <Location /nexus3/*>
        AuthType Basic
        AuthName "Nexus"
        Require valid-user
        AuthBasicProvider file
        AuthUserFile "/etc/apache2/gerrit-users"
        Require valid-user
</Location>
</VirtualHost>

1 个答案:

答案 0 :(得分:1)

你需要设置&#34; X-Forwarded-Proto&#34; Apache中的标题如下所述:

http://books.sonatype.com/nexus-book/reference3/install.html#_example_reverse_proxy_ssl_termination_at_base_path