nginx 反向代理nexus3

Nginx 反向代理 nexus 的服务, 一直卡在 Initialize…,页面加载不全,ui显示有问题

解决方式是添加一个 header: X-Forwarded-Proto

proxy_set_header X-Forwarded-Proto “https”;

下面是整段nginx配置

upstream nexus {
    server 10.88.1.11:8081;
}

server {
    listen 80;
    server_name  nexus.corp.bm-sk.cn;
    rewrite ^(.*)$ https://${server_name}$1 permanent;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;
        proxy_pass http://nexus;
        client_max_body_size       1000m;
        proxy_redirect off;
    }
}

server {
    listen 443;
    server_name  nexus.corp.bm-sk.cn;

    ssl on;
    ssl_certificate ssl/corp.bm-sk.cn/fullchain1.pem;
    ssl_certificate_key ssl/corp.bm-sk.cn/privkey1.pem;

    location / {
        proxy_set_header Host $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 "https";
        proxy_redirect off;
        proxy_pass http://nexus;
        client_max_body_size       1000m;
        proxy_redirect off;
    }

    access_log  logs/nexus.log  main;
}
此条目发表在版本管理分类目录。将固定链接加入收藏夹。