nexus私服开启HTTPS

maven3.8.1以上不允许使用HTTP服务的仓库地址,如果自己搭建的私服需要升级为HTTPS或做一些设置,如果要升级HTTPS服务有两种方式:1、使用Nginx开启HTTPS并反向代理nexus;2、直接在nexus开启HTTPS。这里介绍第二种方式

1、在ssl目录生成证书

这里生成证书的方式为不安全的证书,仅测试用,真实使用的时候还是要购买正式证书
进入nexus安装目录下的ssl目录中,我的在/home/nexus/nexus-3.16.1-02/etc/ssl,通过以下命令生成证书,过程中需填写密码要记住,可统一使用一个,其他信息随便填。

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl req -x509 -days 3650 -key server.key -in server.csr > server.crt
openssl rsa -in server.key -out server.key.unsecure
openssl pkcs12 -export -out keystore.pkcs12 -inkey server.key -in server.crt
keytool -v -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks -deststoretype JKS

运行完成后会生成一个keystore.jks文件
nexus私服开启HTTPS_第1张图片

2、修改jetty-https.xml

修改安装目录下etc/jetty/jetty-https.xml
修改三处密码为上一步生成证书时设置的

nexus私服开启HTTPS_第2张图片

3、修改nexus-default.properties

修改安装目录下etc/nexus-default.properties
添加application-port-ssl参数添加jetty-https配置
nexus私服开启HTTPS_第3张图片

4、重启nexus

可以使用http访问8081,也可以使用https访问18081

nexus私服开启HTTPS_第4张图片

nexus私服开启HTTPS_第5张图片

你可能感兴趣的:(maven,nexus,https,nexus开启https)