Skip to content

Instantly share code, notes, and snippets.

@Seele0oO
Created June 13, 2024 03:03
Show Gist options
  • Save Seele0oO/61d48277f28fd8aea605d1091e382928 to your computer and use it in GitHub Desktop.
Save Seele0oO/61d48277f28fd8aea605d1091e382928 to your computer and use it in GitHub Desktop.
nexus docker repo nginx config example

8001 端口为 docker-proxy 仓库 8002 端口为 docker-hosted 仓库 8003 端口为 docker-group 仓库 所以,你并不能直接复制这个文件,你需要根据你的配置进行修改。

Port 8001 is the docker-proxy repository Port 8002 is the docker-hosted repository Port 8003 is the docker-group repository. So, you can't just copy this file, you need to modify it according to your configuration.

server {
listen 80;
listen 15000 ssl http2;
listen [::]:15000 ssl http2;
listen [::]:80;
server_name 127.0.0.1;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/docker-registry;
# error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/docker-registry/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/docker-registry/privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE ;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
error_page 497 https://$host$request_uri;
client_max_body_size 0;
# SSL-END
# error_page 404 /404.html;
# error_page 502 /502.html;
# ERROR-PAGE-END
location ~ ^/(v1|v2)/[^/]+/?[^/]+/blobs/ {
set $upstream http://10.0.1.129:8003;
if ($request_method ~* (POST|PUT|DELETE|PATCH|HEAD)) {
set $upstream http://10.0.1.129:8002;
}
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 $scheme;
proxy_pass $upstream;
}
location ~ ^/(v1|v2)/ {
set $upstream http://10.0.1.129:8003;
if ($request_method ~* (POST|PUT|DELETE|PATCH)) {
set $upstream http://10.0.1.129:8002;
}
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 $scheme;
proxy_pass $upstream;
}
access_log /www/wwwlogs/docker-registry.log;
error_log /www/wwwlogs/docker-registry.error.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment