Skip to content

Instantly share code, notes, and snippets.

@baseboxorg
Forked from quentinsf/docker-registry.conf
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baseboxorg/c29d7d491cc79ab74e46 to your computer and use it in GitHub Desktop.
Save baseboxorg/c29d7d491cc79ab74e46 to your computer and use it in GitHub Desktop.
server {
server_name docker-registry.mycompany.co.uk ;
listen 80;
# required to avoid HTTP 411: see Issue #1486 (https://github.com/dotcloud/docker/issues/1486)
chunked_transfer_encoding on;
# disable any limits to avoid HTTP 413 for large image uploads
client_max_body_size 0;
root /var/www/docker-registry;
access_log /var/log/nginx/docker-registry.mycompany.co.uk-access.log combined;
error_log /var/log/nginx/docker-registry.mycompany.co.uk-error.log;
# Redirect everything to HTTPS
# rewrite ^(.*) https://$host$1 permanent;
return 301 https://$server_name$request_uri;
}
server {
server_name docker-registry.mycompany.co.uk ;
listen 443;
ssl on;
# required to avoid HTTP 411: see Issue #1486 (https://github.com/dotcloud/docker/issues/1486)
chunked_transfer_encoding on;
# disable any limits to avoid HTTP 413 for large image uploads
client_max_body_size 0;
ssl_certificate /etc/ssl/certs/mycompany.co.uk.chained.crt;
ssl_certificate_key /etc/ssl/private/mycompany-key.pem;
root /var/www/docker-registry;
access_log /var/log/nginx/docker-registry.mycompany.co.uk-access.log combined;
error_log /var/log/nginx/docker-registry.mycompany.co.uk-error.log;
# I suspect these aren't needed when using uwsgi
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header Authorization "";
proxy_read_timeout 900;
location / {
# Doesn't work if these lines are uncommented
#auth_basic "Docker registry";
#auth_basic_user_file /var/run/docker-registry/htpasswd;
include uwsgi_params;
uwsgi_param REMOTE_USER $remote_user;
uwsgi_param AUTH_TYPE Basic;
uwsgi_pass unix:/tmp/docker-registry.sock;
}
location /_ping {
auth_basic off;
include uwsgi_params;
uwsgi_pass unix:/tmp/docker-registry.sock;
}
location /v1/_ping {
auth_basic off;
include uwsgi_params;
uwsgi_pass unix:/tmp/docker-registry.sock;
}
location /v1/users {
include uwsgi_params;
uwsgi_pass unix:/tmp/docker-registry.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment