Last active
November 30, 2022 04:48
-
-
Save hapylestat/10c9b941aa4b24c2139c5c1457910e5c to your computer and use it in GitHub Desktop.
NEXUS Docker reverse proxy via nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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