我试图让 Gitlab 在 Nginx 后面工作。我的配置:
Nginx:
upstream gitlab-workhorse {
server unix:/var/opt/gitlab/gitlab-workhorse/sockets/socket fail_timeout=0;
}
location /gitlab/ {
rewrite ^/gitlab(/.*)$ $1 break;
client_max_body_size 0;
gzip off;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://gitlab-workhorse;
}
/etc/gitlab/gitlab.rb:
external_url "https://myhostname.com/gitlab"
web_server['external_users'] = ['www-data']
nginx['enable'] = false
gitlab_workhorse['enable'] = true
gitlab_workhorse['listen_network'] = "unix"
gitlab_workhorse['listen_addr'] = "/var/opt/gitlab/gitlab-workhorse/sockets/socket"
应 myhost.com/gitlab/users/sign_in 的请求,我得到“/users/sign_in”未找到
如果我更改 gitlab 配置
external_url "https://myhostname.com/"
(最后没有/gitlab
路径)它开始工作,但它总是重定向到服务器的 / 而不是 /gitlab