本文转自: https://www.cnblogs.com/tiantiandas/p/nginx_reverse_proxy_nexus.html
Nginx 反向代理 nexus 的服务, 一直卡在 Initialize...
解决方式是添加一个 header X-Forwarded-Proto
:
proxy_set_header X-Forwarded-Proto "https";
nexus.conf
upstream nexus-server{
server 127.0.0.1:8081;
}
server {
listen 80;
server_name xx.xx;
location / {
return 301 https://xx.xx;
}
location ~ /.well-known {
root /tmp;
}
}
server {
listen 443 ssl;
server_name xx.xx;
ssl_certificate cert/xx.pem;
ssl_certificate_key cert/xx.key;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto "https";
proxy_pass http://nexus-server;
}
}
网友评论