Skip to content

Instantly share code, notes, and snippets.

@hapylestat
Last active November 30, 2022 04:48
Show Gist options
  • Save hapylestat/10c9b941aa4b24c2139c5c1457910e5c to your computer and use it in GitHub Desktop.
Save hapylestat/10c9b941aa4b24c2139c5c1457910e5c to your computer and use it in GitHub Desktop.
NEXUS Docker reverse proxy via nginx
upstream nexus_registry {
server 10.236.0.5:20080 max_fails=3 fail_timeout=10s;
}
map $status $nexus_auth {
401 'Bearer realm="https://host:8888/v2/token",service="https://host:8888/v2/token"';
}
server {
listen 8888 ssl;
server_name host;
include self-signed.conf;
include ssl-params.conf;
client_max_body_size 10000M;
location / {
proxy_pass http://nexus_registry;
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 "http";
proxy_set_header User-Agent: "Go-http-client";
proxy_intercept_errors on;
proxy_hide_header WWW-Authenticate;
add_header WWW-Authenticate $nexus_auth always;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment