注: 有关 Nexus 目录的更多信息,参见 https://help.sonatype.com/repomanager3/installation-and-upgrades/directories。
步骤
- 将密钥库文件复制到 $install-dir\etc\ssl 文件夹。
-
编辑 $data-dir\etc\nexus.properties 文件,添加 SSL 端口并引用 SSL 配置文件。
# Jetty section application-port=8081 application-port-ssl=8441 application-host=0.0.0.0 nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-https.xml,${jetty.etc}/jetty-requestlog.xml nexus-context-path=/
-
编辑 SSL 配置文件 $install-dir\etc\jetty\jetty-https.xml,设置证书及密码:
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory"> <Set name="KeyStorePath"><Property name="ssl.etc"/>/keystore.jks</Set> <Set name="KeyStorePassword">password</Set> <Set name="KeyManagerPassword">password</Set>
因为密钥库文件必须位于一个特定的目录,配置中的路径必需为密钥库的文件名 (紧随一个斜杠)。
- 启动 Nexus,您即可通过 SSL 端口登录 Nexus URL。