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;
|
|
|
|
|
|
|
|
# this is necessary for us to be able to disable request buffering in all cases
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
|
|
|
upstream core {
|
2020-04-28 07:17:24 +02:00
|
|
|
{% if internal_tls.enabled %}
|
|
|
|
server core:8443;
|
|
|
|
{% else %}
|
2018-11-15 04:09:57 +01:00
|
|
|
server core:8080;
|
2020-04-28 07:17:24 +02:00
|
|
|
{% endif %}
|
2018-11-15 04:09:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
upstream portal {
|
2020-04-28 07:17:24 +02:00
|
|
|
{% if internal_tls.enabled %}
|
|
|
|
server portal:8443;
|
|
|
|
{% else %}
|
2019-07-22 08:21:28 +02:00
|
|
|
server portal:8080;
|
2020-04-28 07:17:24 +02:00
|
|
|
{% endif %}
|
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;
|
|
|
|
|
2021-02-25 10:43:55 +01:00
|
|
|
map $http_x_forwarded_proto $x_forwarded_proto {
|
|
|
|
default $http_x_forwarded_proto;
|
|
|
|
"" $scheme;
|
|
|
|
}
|
|
|
|
|
2018-11-15 04:09:57 +01:00
|
|
|
server {
|
2019-07-29 09:52:17 +02:00
|
|
|
listen 8080;
|
2018-11-15 04:09:57 +01:00
|
|
|
server_tokens off;
|
|
|
|
# disable any limits to avoid HTTP 413 for large image uploads
|
|
|
|
client_max_body_size 0;
|
|
|
|
|
2019-09-20 10:11:39 +02:00
|
|
|
# Add extra headers
|
|
|
|
add_header X-Frame-Options DENY;
|
|
|
|
add_header Content-Security-Policy "frame-ancestors 'none'";
|
|
|
|
|
2021-02-18 03:54:32 +01:00
|
|
|
# customized location config file can place to /etc/nginx/etc with prefix harbor.http. and suffix .conf
|
2018-11-15 04:09:57 +01:00
|
|
|
include /etc/nginx/conf.d/harbor.http.*.conf;
|
|
|
|
|
|
|
|
location / {
|
2020-04-28 07:17:24 +02:00
|
|
|
{% if internal_tls.enabled %}
|
|
|
|
proxy_pass https://portal/;
|
|
|
|
|
|
|
|
proxy_ssl_certificate /etc/harbor/tls/proxy.crt;
|
|
|
|
proxy_ssl_certificate_key /etc/harbor/tls/proxy.key;
|
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
|
|
|
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://portal/;
|
2020-04-28 07:17:24 +02: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;
|
2021-02-25 10:43:55 +01:00
|
|
|
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /c/ {
|
2020-04-28 07:17:24 +02: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;
|
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
|
|
|
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-04-28 07:17:24 +02: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;
|
2021-02-25 10:43:55 +01:00
|
|
|
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /api/ {
|
2020-04-28 07:17:24 +02: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;
|
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
|
|
|
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-04-28 07:17:24 +02: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;
|
2021-02-25 10:43:55 +01:00
|
|
|
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /chartrepo/ {
|
2020-04-28 07:17:24 +02: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;
|
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
|
|
|
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-04-28 07:17:24 +02: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;
|
2021-02-25 10:43:55 +01:00
|
|
|
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /v1/ {
|
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /v2/ {
|
2020-04-28 07:17:24 +02: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;
|
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
|
|
|
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-04-28 07:17:24 +02: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;
|
2021-02-25 10:43:55 +01:00
|
|
|
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
|
2018-11-15 04:09:57 +01:00
|
|
|
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-04-28 07:17:24 +02: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;
|
|
|
|
proxy_ssl_trusted_certificate /harbor_cust_cert/harbor_internal_ca.crt;
|
|
|
|
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-04-28 07:17:24 +02: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;
|
2021-02-25 10:43:55 +01:00
|
|
|
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_request_buffering off;
|
|
|
|
}
|
|
|
|
|
2019-07-29 09:52:17 +02:00
|
|
|
location /service/notifications {
|
2018-11-15 04:09:57 +01:00
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
}
|
2020-10-18 18:16:02 +02:00
|
|
|
{% if metric.enabled %}
|
|
|
|
upstream core_metrics {
|
2021-02-05 19:44:28 +01:00
|
|
|
server core:{{ metric.port }};
|
2020-10-18 18:16:02 +02:00
|
|
|
}
|
|
|
|
|
2021-03-15 17:25:53 +01:00
|
|
|
upstream js_metrics {
|
|
|
|
server jobservice:{{ metric.port }};
|
|
|
|
}
|
|
|
|
|
2020-10-18 18:16:02 +02:00
|
|
|
upstream registry_metrics {
|
2021-02-05 19:44:28 +01:00
|
|
|
server registry:{{ metric.port }};
|
2020-10-18 18:16:02 +02:00
|
|
|
}
|
2020-11-17 13:14:11 +01:00
|
|
|
|
|
|
|
upstream harbor_exporter {
|
|
|
|
server exporter:8080;
|
|
|
|
}
|
|
|
|
|
2020-10-18 18:16:02 +02:00
|
|
|
server {
|
|
|
|
listen 9090;
|
|
|
|
location = /metrics {
|
|
|
|
if ($arg_comp = core) { proxy_pass http://core_metrics; }
|
2021-03-15 17:25:53 +01:00
|
|
|
if ($arg_comp = jobservice) { proxy_pass http://js_metrics; }
|
2020-10-18 18:16:02 +02:00
|
|
|
if ($arg_comp = registry) { proxy_pass http://registry_metrics; }
|
2020-11-17 13:14:11 +01:00
|
|
|
proxy_pass http://harbor_exporter;
|
2020-10-18 18:16:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
{% endif %}
|
2018-11-15 04:09:57 +01:00
|
|
|
}
|