1

我在将 nginx 配置为 gitlab 的代理时遇到问题。

我使用以下端口配置运行 gitlab:

sudo docker run --detach \
    --hostname gitlab.myserver.com \
    --publish 8929:80 --publish 2289:22 \
    --name gitlab \
    --restart always \
    --volume /srv/gitlab/config:/etc/gitlab \
    --volume /srv/gitlab/logs:/var/log/gitlab \
    --volume /srv/gitlab/data:/var/opt/gitlab \
    gitlab/gitlab-ce:latest

现在我打算使用 nginx 作为多个 docker 容器的代理:

docker run --name nginx-proxy -v ./nginx.conf:/etc/nginx/nginx.conf:ro -d nginx

在浏览 gitlab.myserver.com 时,以下配置是否足以使 gitlab 可访问

upstream gitlab.myserver.com {
    server localhost:8929;
}

server {
    gzip_types text/plain text/css application/json application/x-javascript
               text/xml application/xml application/xml+rss text/javascript;

    server_name gitlab.myserver.com;

    location / {
        proxy_pass http://gitlab.myserver.com;
        include /etc/nginx/proxy_params;
    }
}
4

0 回答 0