6

gitlab の nginx 構成は次のとおりです。

# GITLAB
# Maintainer: @randx
# App Version: 3.0

upstream gitlab {
  server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;
}

server {
  listen YOUR_SERVER_IP:80;         # e.g., listen 192.168.1.1:80;
  server_name YOUR_SERVER_FQDN;     # e.g., server_name source.example.com;
  root /home/gitlab/gitlab/public;

  # individual nginx logs for this gitlab vhost
  access_log  /var/log/nginx/gitlab_access.log;
  error_log   /var/log/nginx/gitlab_error.log;

  location / {
    # serve static files from defined root folder;.
    # @gitlab is a named location for the upstream fallback, see below
    try_files $uri $uri/index.html $uri.html @gitlab;
  }

  # if a file, which is not found in the root folder is requested,
  # then the proxy pass the request to the upsteam (gitlab unicorn)
  location @gitlab {
    proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
    proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
    proxy_redirect     off;

    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   Host              $http_host;
    proxy_set_header   X-Real-IP         $remote_addr;

    proxy_pass http://gitlab;
  }
}

www.mysuperserver.com/gitlabというsurURIとしてgitlabを提供するには、何を変更すればよいですか

いろいろ試しましたが、うまくいきませんでしたありがとう

4

5 に答える 5

3

サブディレクトリの URL で正常に動作するようにしました。

  • 次のように、ソース コードの指示に従います。/home/git/gitlab/config/gitlab.yml
    # 最後の行のコメントを外してカスタマイズし、非ルート パスで実行します
    # 警告: GitLab をホストするための FQDN を、これではなくルート パスで作成することをお勧めします。
    # これを機能させるには、4 つの設定を変更する必要があることに注意してください。
    # 1) application.rb ファイル内: config.relative_url_root = "/gitlab"
    # 2) gitlab.yml ファイル内: relative_url_root: /gitlab
    # 3) unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
    # 4) ../gitlab-shell/config.yml 内: gitlab_url: "http://127.0.0.1/gitlab"
    # パスを更新するには、次を実行します: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
    #
    relative_url_root: /gitlab
  • サブリを提供するようにnginx構成を変更してください。以下の例を参照してください。

重要なポイントは、rootアンダー コンテキストserveraliasアンダーlocationです。詳細については、 nginx の落とし穴nginx ルート ノートを参照してください。

# default.conf for nginx
upstream gitlab {
  server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
    listen       80;
    server_name  $YOUR_DOMAIN;
    # other settings, especially root settings, like below
    # root /usr/local/nginx/html;
    location /gitlab {
        # serve static files from defined root folder;
        alias /home/git/gitlab/public;

        # individual nginx logs for this gitlab vhost
        access_log  /var/log/nginx/gitlab_access.log;
        error_log   /var/log/nginx/gitlab_error.log;

        # @gitlab is a named location for the upstream fallback, see below
        try_files $uri $uri/index.html $uri.html @gitlab;
    }

    location @gitlab {
        proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
        proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
        proxy_redirect     off;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   Host              $http_host;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;

        proxy_pass http://gitlab;
    }
    # other locations' settings...
}
于 2014-01-21T03:14:44.323 に答える
1

この問題はもう解決しましたか?

location /そうでない場合は、ディレクティブを次のように更新してみてください。

location /gitlab {
  # serve static files from defined root folder;.
  root /home/gitlab/gitlab/public;
  # @gitlab is a named location for the upstream fallback, see below
  try_files $uri $uri/index.html $uri.html @gitlab;
}

それでもうまくいかない場合は、 の最後の数行を貼り付けてください/var/log/nginx/gitlab_error.log

于 2012-12-15T09:19:32.223 に答える
-1

この構成は機能します

# GITLAB
# Maintainer: @randx
# App Version: 3.0

upstream gitlab {
  server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;
}

server {
  listen 80;         # e.g., listen 192.168.1.1:80; 37.59.125.28:
  server_name gitlab.<YOUR_DOMAIN>.com;     # e.g., server_name source.example.com;
  root /home/gitlab/gitlab/public;

  # individual nginx logs for this gitlab vhost
  access_log  /var/log/nginx/gitlab_access.log;
  error_log   /var/log/nginx/gitlab_error.log;

  location / {
    # serve static files from defined root folder;.
    # @gitlab is a named location for the upstream fallback, see below
    try_files $uri $uri/index.html $uri.html @gitlab;
  }

  # if a file, which is not found in the root folder is requested,
  # then the proxy pass the request to the upsteam (gitlab unicorn)
  location @gitlab {
    proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
    proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
    proxy_redirect     off;

    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   Host              $http_host;
    proxy_set_header   X-Real-IP         $remote_addr;

    proxy_pass http://gitlab;
  }
}

また、nginx の使用可能な構成と有効な構成の間のシンボリック リンクが不良でした。

于 2012-12-15T17:57:04.243 に答える