我在公司农场内的服务器上安装了港口,我可以通过https://my-internal-server.com/harbor使用它,没有问题。
我试图将反向代理规则添加到Apache中,以便通过公共服务器访问它,用于港口、v2、chartrepo、服务端点(如https://my-public-server.com/harbor ),但这是行不通的。
例如:
ProxyPass /harbor https://eslregistry.eng.it/harbor
ProxyPassReverse /harbor https://eslregistry.eng.it/harbor我还在harbor.yaml中设置了:
当我尝试用浏览器访问https://my-public-server.com/harbor时,我看到一个加载.页面和404错误用于静态资源,因为它试图通过以下GET:https://my-public-server.com/scripts.a459d5a2820e9a99.js获取它们
我如何配置它来工作呢?
发布于 2022-05-12 19:20:56
您应该传递整个域,而不仅仅是路径。看看官方的Nginx配置,了解一下这是什么样子。
upstream harbor {
server harbor_proxy_ip:8080;
}
server {
listen 443 ssl;
server_name harbor.mycomp.com;
ssl_certificate /etc/nginx/conf.d/mycomp.com.crt;
ssl_certificate_key /etc/nginx/conf.d/mycomp.com.key;
client_max_body_size 0;
chunked_transfer_encoding on;
location / {
proxy_pass http://harbor/;
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;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}请注意,您应该禁用代理或缓冲。
https://stackoverflow.com/questions/72219092
复制相似问题