Created
July 1, 2014 13:21
-
-
Save quentinsf/b99f19c6f32df20e8eda to your computer and use it in GitHub Desktop.
Nginx, uwsgi and docker registry
This file contains hidden or 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
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