Nexus 3.3 忽略基础 URL 设置

Nexus 3.3 ignores base URL settings

尝试设置 Nexus 3.3.2-02,Jetty 似乎忽略了基础 URL 配置中的 HTTPS。 Nexus 访问了着陆页但挂在 "Initializing" 并且无法加载静态内容。

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

如果我直接加载 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>

您需要按照此处所述在 Apache 中设置 "X-Forwarded-Proto" header:

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