2018-11-15 04:09:57 +01:00
|
|
|
worker_processes auto;
|
2019-07-29 09:52:17 +02:00
|
|
|
pid /tmp/nginx.pid;
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
use epoll;
|
|
|
|
multi_accept on;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
2019-07-29 09:52:17 +02:00
|
|
|
client_body_temp_path /tmp/client_body_temp;
|
|
|
|
proxy_temp_path /tmp/proxy_temp;
|
|
|
|
fastcgi_temp_path /tmp/fastcgi_temp;
|
|
|
|
uwsgi_temp_path /tmp/uwsgi_temp;
|
|
|
|
scgi_temp_path /tmp/scgi_temp;
|
2018-11-15 04:09:57 +01:00
|
|
|
tcp_nodelay on;
|
|
|
|
include /etc/nginx/conf.d/*.upstream.conf;
|
|
|
|
|
|
|
|
# this is necessary for us to be able to disable request buffering in all cases
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
|
|
|
upstream core {
|
2020-02-11 06:47:55 +01:00
|
|
|
{% if internal_tls.enabled %}
|
2020-02-11 07:03:04 +01:00
|
|
|
server core:8443;
|
2020-02-11 06:47:55 +01:00
|
|
|
{% else %}
|
2018-11-15 04:09:57 +01:00
|
|
|
server core:8080;
|
2020-02-11 06:47:55 +01:00
|
|
|
{% endif %}
|
2018-11-15 04:09:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
upstream portal {
|
2019-07-22 08:21:28 +02:00
|
|
|
server portal:8080;
|
2018-11-15 04:09:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
log_format timed_combined '$remote_addr - '
|
|
|
|
'"$request" $status $body_bytes_sent '
|
|
|
|
'"$http_referer" "$http_user_agent" '
|
|
|
|
'$request_time $upstream_response_time $pipe';
|
|
|
|
|
|
|
|
access_log /dev/stdout timed_combined;
|
|
|
|
|
|
|
|
include /etc/nginx/conf.d/*.server.conf;
|
|
|
|
|
|
|
|
server {
|
2019-07-29 09:52:17 +02:00
|
|
|
listen 8443 ssl;
|
2018-11-15 04:09:57 +01:00
|
|
|
# server_name harbordomain.com;
|
|
|
|
server_tokens off;
|
|
|
|
# SSL
|
|
|
|
ssl_certificate {{ssl_cert}};
|
|
|
|
ssl_certificate_key {{ssl_cert_key}};
|
|
|
|
|
|
|
|
# Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
|
2019-08-07 17:44:43 +02:00
|
|
|
ssl_protocols TLSv1.2;
|
2018-11-15 04:09:57 +01:00
|
|
|
ssl_ciphers '!aNULL:kECDH+AESGCM:ECDH+AESGCM:RSA+AESGCM:kECDH+AES:ECDH+AES:RSA+AES:';
|
|
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
ssl_session_cache shared:SSL:10m;
|
|
|
|
|
|
|
|
# disable any limits to avoid HTTP 413 for large image uploads
|
|
|
|
client_max_body_size 0;
|
|
|
|
|
|
|
|
# required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
|
|
|
|
chunked_transfer_encoding on;
|
|
|
|
|
2019-09-20 10:11:39 +02:00
|
|
|
# Add extra headers
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
|
|
|
|
add_header X-Frame-Options DENY;
|
|
|
|
add_header Content-Security-Policy "frame-ancestors 'none'";
|
|
|
|
|
2018-11-15 04:09:57 +01:00
|
|
|
# costumized location config file can place to /etc/nginx dir with prefix harbor.https. and suffix .conf
|
|
|
|
include /etc/nginx/conf.d/harbor.https.*.conf;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
proxy_pass http://portal/;
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
2019-09-19 14:38:19 +02:00
|
|
|
proxy_cookie_path / "/; HttpOnly; Secure";
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /c/ {
|
2020-02-11 06:47:55 +01:00
|
|
|
{% if internal_tls.enabled %}
|
|
|
|
proxy_pass https://core/c/;
|
|
|
|
|
|
|
|
proxy_ssl_certificate /etc/harbor/tls/proxy.crt;
|
|
|
|
proxy_ssl_certificate_key /etc/harbor/tls/proxy.key;
|
2020-04-26 09:00:51 +02:00
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
2020-02-11 06:47:55 +01:00
|
|
|
proxy_ssl_verify_depth 2;
|
|
|
|
proxy_ssl_verify on;
|
|
|
|
proxy_ssl_session_reuse on;
|
|
|
|
{% else %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_pass http://core/c/;
|
2020-02-11 06:47:55 +01:00
|
|
|
{% endif %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2019-09-19 14:38:19 +02:00
|
|
|
|
|
|
|
proxy_cookie_path / "/; Secure";
|
|
|
|
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /api/ {
|
2020-02-11 06:47:55 +01:00
|
|
|
{% if internal_tls.enabled %}
|
|
|
|
proxy_pass https://core/api/;
|
|
|
|
|
|
|
|
proxy_ssl_certificate /etc/harbor/tls/proxy.crt;
|
|
|
|
proxy_ssl_certificate_key /etc/harbor/tls/proxy.key;
|
2020-04-26 09:00:51 +02:00
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
2020-02-11 06:47:55 +01:00
|
|
|
proxy_ssl_verify_depth 2;
|
|
|
|
proxy_ssl_verify on;
|
|
|
|
proxy_ssl_session_reuse on;
|
|
|
|
{% else %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_pass http://core/api/;
|
2020-02-11 06:47:55 +01:00
|
|
|
{% endif %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2019-09-19 14:38:19 +02:00
|
|
|
|
|
|
|
proxy_cookie_path / "/; Secure";
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /chartrepo/ {
|
2020-02-11 06:47:55 +01:00
|
|
|
{% if internal_tls.enabled %}
|
|
|
|
proxy_pass https://core/chartrepo/;
|
|
|
|
|
|
|
|
proxy_ssl_certificate /etc/harbor/tls/proxy.crt;
|
|
|
|
proxy_ssl_certificate_key /etc/harbor/tls/proxy.key;
|
2020-04-26 09:00:51 +02:00
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
2020-02-11 06:47:55 +01:00
|
|
|
proxy_ssl_verify_depth 2;
|
|
|
|
proxy_ssl_verify on;
|
|
|
|
proxy_ssl_session_reuse on;
|
|
|
|
{% else %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_pass http://core/chartrepo/;
|
2020-02-11 06:47:55 +01:00
|
|
|
{% endif %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2019-09-19 14:38:19 +02:00
|
|
|
|
|
|
|
proxy_cookie_path / "/; Secure";
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /v1/ {
|
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /v2/ {
|
2020-02-11 06:47:55 +01:00
|
|
|
{% if internal_tls.enabled %}
|
|
|
|
proxy_pass https://core/v2/;
|
|
|
|
|
|
|
|
proxy_ssl_certificate /etc/harbor/tls/proxy.crt;
|
|
|
|
proxy_ssl_certificate_key /etc/harbor/tls/proxy.key;
|
2020-04-26 09:00:51 +02:00
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
2020-02-11 06:47:55 +01:00
|
|
|
proxy_ssl_verify_depth 2;
|
|
|
|
proxy_ssl_verify on;
|
|
|
|
proxy_ssl_session_reuse on;
|
|
|
|
{% else %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_pass http://core/v2/;
|
2020-02-11 06:47:55 +01:00
|
|
|
{% endif %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
2020-05-26 10:11:57 +02:00
|
|
|
proxy_send_timeout 900;
|
|
|
|
proxy_read_timeout 900;
|
2018-11-15 04:09:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
location /service/ {
|
2020-02-11 06:47:55 +01:00
|
|
|
{% if internal_tls.enabled %}
|
|
|
|
proxy_pass https://core/service/;
|
|
|
|
|
|
|
|
proxy_ssl_certificate /etc/harbor/tls/proxy.crt;
|
|
|
|
proxy_ssl_certificate_key /etc/harbor/tls/proxy.key;
|
2020-04-26 09:00:51 +02:00
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
2020-02-11 06:47:55 +01:00
|
|
|
proxy_ssl_verify_depth 2;
|
|
|
|
proxy_ssl_verify on;
|
|
|
|
proxy_ssl_session_reuse on;
|
|
|
|
{% else %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_pass http://core/service/;
|
2020-02-11 06:47:55 +01:00
|
|
|
{% endif %}
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
2019-09-19 14:38:19 +02:00
|
|
|
proxy_cookie_path / "/; Secure";
|
|
|
|
|
2018-11-15 04:09:57 +01:00
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
2019-08-01 20:51:27 +02:00
|
|
|
|
|
|
|
location /service/notifications {
|
2018-11-15 04:09:57 +01:00
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
}
|
2019-08-01 20:51:27 +02:00
|
|
|
server {
|
2019-07-29 09:52:17 +02:00
|
|
|
listen 8080;
|
|
|
|
#server_name harbordomain.com;
|
2019-11-28 12:57:49 +01:00
|
|
|
return 308 https://{{https_redirect}}$request_uri;
|
2018-11-15 04:09:57 +01:00
|
|
|
}
|
|
|
|
}
|