document Nginx config when set uo Harbor behind other proxy

This commit is contained in:
xiahaoshawn 2016-04-22 15:12:08 +08:00
parent e7fe841b03
commit c818b63183
4 changed files with 21 additions and 15 deletions

View File

@ -33,7 +33,10 @@ http {
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;
proxy_buffering off;
proxy_request_buffering off;
}
@ -47,7 +50,10 @@ http {
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;
proxy_buffering off;
proxy_request_buffering off;
@ -58,7 +64,10 @@ http {
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;
proxy_buffering off;
proxy_request_buffering off;
}

View File

@ -45,10 +45,10 @@ http {
location / {
proxy_pass http://ui/;
proxy_set_header Host $http_host;
# Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing.
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;
@ -62,10 +62,10 @@ http {
location /v2/ {
proxy_pass http://registry/v2/;
proxy_set_header Host $http_host;
# Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing.
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;
@ -76,10 +76,10 @@ http {
location /service/ {
proxy_pass http://ui/service/;
proxy_set_header Host $http_host;
# Remove the following three lines if setting up harbor behind an nginx proxy or Elastic Load Balancing.
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;

View File

@ -125,10 +125,3 @@ After setting up HTTPS for Harbor, you can verify it by the follow steps:
update-ca-trust
```
3. If setting up harbor behind an nginx proxy or elastic load balancing, harbor nginx will reset the values of x-fowarded-XXX headers from first layer nginx or elastic load balancing, and the requests will not be routed properly.
In this situation remove the following lines in "location /", "location /v2/" and "location /service/" sections.
```
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
```

View File

@ -204,3 +204,7 @@ $ rm -r /data/registry
### Persistent data and log files
By default, the data of database and image files in the registry are persisted in the directory **/data/** of the target machine. When Harbor's containers are removed and recreated, the data remain unchanged. Harbor leverages rsyslog to collect the logs of each container, by default the log files are stored in the directory **/var/log/harbor/** on Harbor's host.
##Troubleshooting
1.When setting up Harbor behind another nginx proxy or elastic load balancing, remove the below line if the proxy already has similar settings. Be sure to remove the line under these 3 sections: "location /", "location /v2/" and "location /service/".
proxy_set_header X-Forwarded-Proto $scheme;