reverse-proxy-configs/conf.d/registry.conf
2023-11-15 09:40:53 -06:00

70 lines
2.2 KiB
Text
Executable file

# Taken from HTTP Toolkit's registry facade.
# GitHub: https://github.com/httptoolkit/docker-registry-facade
# Blog post: https://httptoolkit.com/blog/docker-image-registry-facade/
# This is arguably worse than the original, since it allows you to pull images from any org, but it's just redirects anyways, it doesn't really matter.
server {
server_name docker.askiiart.net;
location / {
return 301 https://registry.askiiart.net$request_uri;
}
#location / {
# add_header Content-Type "application/json";
# return 403 '{"errors": [{"message": "Only API requests for askiiart images are supported"}]}';
#}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/askiiart.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/askiiart.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name registry.askiiart.net;
location /v2 {
return 307 https://registry.hub.docker.com$request_uri;
}
#location / {
# add_header Content-Type "application/json";
# return 403 '{"errors": [{"message": "Only API requests for images are supported"}]}';
#}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/askiiart.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/askiiart.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = docker.askiiart.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name docker.askiiart.net;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = registry.askiiart.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name registry.askiiart.net;
listen 80;
return 404; # managed by Certbot
}