2016-06-02 11:05:42 +05:30
|
|
|
## Lines starting with two hashes (##) are comments with information.
|
|
|
|
## Lines starting with one hash (#) are configuration parameters that can be uncommented.
|
|
|
|
##
|
|
|
|
###################################
|
|
|
|
## configuration ##
|
|
|
|
###################################
|
|
|
|
|
|
|
|
## Redirects all HTTP traffic to the HTTPS host
|
|
|
|
server {
|
|
|
|
listen *:80;
|
|
|
|
server_name registry.gitlab.example.com;
|
|
|
|
server_tokens off; ## Don't show the nginx version number, a security best practice
|
2018-11-18 11:00:15 +05:30
|
|
|
return 301 https://$http_host$request_uri;
|
2016-06-02 11:05:42 +05:30
|
|
|
access_log /var/log/nginx/gitlab_registry_access.log gitlab_access;
|
|
|
|
error_log /var/log/nginx/gitlab_registry_error.log;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2019-12-04 20:38:33 +05:30
|
|
|
# If a different port is specified in https://gitlab.com/gitlab-org/gitlab-foss/blob/8-8-stable/config/gitlab.yml.example#L182,
|
2016-06-02 11:05:42 +05:30
|
|
|
# it should be declared here as well
|
|
|
|
listen *:443 ssl http2;
|
|
|
|
server_name registry.gitlab.example.com;
|
|
|
|
server_tokens off; ## Don't show the nginx version number, a security best practice
|
|
|
|
|
|
|
|
client_max_body_size 0;
|
|
|
|
chunked_transfer_encoding on;
|
|
|
|
|
|
|
|
## Strong SSL Security
|
|
|
|
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
|
|
|
|
ssl_certificate /etc/gitlab/ssl/registry.gitlab.example.com.crt
|
|
|
|
ssl_certificate_key /etc/gitlab/ssl/registry.gitlab.example.com.key
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
ssl_session_timeout 1d;
|
|
|
|
ssl_session_cache shared:SSL:10m;
|
|
|
|
ssl_session_tickets off;
|
|
|
|
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
|
|
|
ssl_prefer_server_ciphers off;
|
|
|
|
|
|
|
|
## [Optional] Generate a stronger DHE parameter:
|
|
|
|
## sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
|
|
|
|
##
|
|
|
|
# ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
|
|
|
|
|
|
|
## [Optional] Enable HTTP Strict Transport Security
|
|
|
|
# add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
access_log /var/log/gitlab/nginx/gitlab_registry_access.log gitlab_access;
|
|
|
|
error_log /var/log/gitlab/nginx/gitlab_registry_error.log;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
proxy_set_header Host $http_host; # required for docker client's sake
|
|
|
|
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_read_timeout 900;
|
|
|
|
|
|
|
|
proxy_pass http://localhost:5000;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|