2017-10-18 14 views
0

nginxリバースプロキシを使用する必要があります。したがって、私はjwilder/nginx-proxy. Also I'm using gitLab as a docker container. So I came up with this docker-compose file, but accessing ci.server.com gives me a 502 Bad Gateway`エラーを使用します。Nginxリバースプロキシ:gitlabコンテナのjwilder/nginx-proxyを使用して正しいポートを設定してください。

私は私が働いていたこのドッキングウィンドウ・コンセットアップを使用リバースプロキシをnginxのに切り替え前に、私はこのドッキングウィンドウコンテナ

version: '3.3' 
services: 
    nginx: 
    container_name: 'nginx' 
    image: jwilder/nginx-proxy:alpine 
    restart: 'always' 
    ports: 
     - 80:80 
    volumes: 
     - /var/run/docker.sock:/tmp/docker.sock:ro 

    gitlab: 
    container_name: gitlab 
    image: 'gitlab/gitlab-ce:10.0.2-ce.0' 
    restart: always 
    hostname: 'ci.server.com' 
    ports: 
     - '50022:22' 
    volumes: 
     - '/opt/gitlab/config:/etc/gitlab' 
     - '/opt/gitlab/logs:/var/log/gitlab' 
     - '/opt/gitlab/data:/var/opt/gitlab' 
     - '/opt/gitlab/secret:/secret/gitlab/backups' 
     - '/etc/letsencrypt:/etc/letsencrypt' 
    environment: 
     VIRTUAL_HOST: ci.server.com 
     VIRTUAL_PORT: 50022 

のための適切なポートの設定にいくつかの助けを必要としています。そして私はこれを「変換」することによって違いや間違いを得ません。

古い

version: '3.3' 
services: 
    nginx: 
    container_name: 'nginx' 
    image: 'nginx:1.13.5' 
    restart: 'always' 
    ports: 
     - '80:80' 
     - '443:443' 
    volumes: 
     - '/opt/nginx/conf.d:/etc/nginx/conf.d:ro' 
     - '/opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro' 
     - '/etc/letsencrypt:/etc/letsencrypt' 
    links: 
     - 'gitlab' 

    gitlab: 
    container_name: gitlab 
    image: 'gitlab/gitlab-ce:10.0.2-ce.0' 
    restart: always 
    hostname: 'ci.server.com' 
    ports: 
     - '50022:22' 
    volumes: 
     - '/opt/gitlab/config:/etc/gitlab' 
     - '/opt/gitlab/logs:/var/log/gitlab' 
     - '/opt/gitlab/data:/var/opt/gitlab' 
     - '/opt/gitlab/secret:/secret/gitlab/backups' 
     - '/etc/letsencrypt:/etc/letsencrypt' 
+0

以前のnginx設定は何でしたか? –

答えて

2

ご使用の環境にVIRTUAL_PORT: 80を設定する必要があります。

プロキシが実際に80ポートをSSHポートにリダイレクトしようとしています。

あなたは、私がこれを使用し、例えばhere

を見ることができますjwilderproxyでSSLを使用するには。

version: '3/3' services: gitlab: container_name: gitlab image: 'gitlab/gitlab-ce:10.0.2-ce.0' restart: always hostname: 'ci.server.com' ports: - '50022:22' volumes: - '/opt/gitlab/config:/etc/gitlab' - '/opt/gitlab/logs:/var/log/gitlab' - '/opt/gitlab/data:/var/opt/gitlab' - '/opt/gitlab/secret:/secret/gitlab/backups' - '/etc/letsencrypt:/etc/letsencrypt' environment: - VIRTUAL_HOST=ci.server.com - VIRTUAL_PORT=80 - LETSENCRYPT_HOST=ci.server.com - LETSENCRYPT_EMAIL=youremail

+0

私のgitlabの設定でそれを説明できますか?私はポートに夢中になっています...私はsslを介してgitlabを呼び出すので、私は443とvirtual_portも443を公開しようとしました – user3142695

関連する問題