我已经从Nexus2迁移到Nexus3。但也有一个问题,nexus3不支持解压插件。因此,我想出的解决办法是部署一个nexus2容器,并将所有解压缩的repos代理到nexus2。然后当url以".zip-unzip“结尾时创建一个重定向链接,重定向到nexus2。这可以在nginx配置上完成。而且它还应该保留nexus3 url,但显示nexus2页面。
为此,我使用正则表达式定义了一个位置块,以匹配以".zip-unzip“结尾的urls和nexus2的代理传递。但它似乎不起作用。我也不确定如何让nexus2同时也是ssl加密的。
服务器{
listen 443 ssl;
server_name mt-nexus.psi-mt.de;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_certificate /etc/nginx/conf.d/server.crt;
ssl_certificate_key /etc/nginx/conf.d/server.key;
include /etc/nginx/custom-errors.conf;
client_max_body_size 1G;
location / {
proxy_pass http://nexus3:8081;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 900;
}
location ~ ^"/nexus/(?<section>.+).zip-unzip$" {
proxy_pass http://nexus2:8081/$section.zip-unzip;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto "https";
}
}我希望当传递url "https://nexus3.xyz.com/nexus/content/repositories/Releases_Unzip/xxx.zip-unzip“时,它会重定向到nexus2URL链接"https://nexus2.xyz.com/nexus/content/repositories/Releases_Unzip/xxx.zip-unzip”,但保留了nexus3的url,即https://nexus3.xyz.com/...
发布于 2019-05-23 21:22:08
我自己解决的问题。您必须使用位置块,但是在使用代理传递时,位置块不支持使用"$“。因此,您必须在location块中使用重写,如下所示。
location ~ .zip-unzip/ {
rewrite ^/nexus/(.*)$ /nexus/$1 break;
proxy_pass http://nexus4unzip:8081;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}https://stackoverflow.com/questions/56150034
复制相似问题