0

nginx の設定に成功しました。デフォルトのサイトでは正しく動作します。現在、/home/bugz に 1 つと /home/git/github/public に 1 つの 2 つのサイトがあります。IP 10.10.10.10 は 1 つだけです (DNS をセットアップしていないため、ドメイン名を使用できません)

http://10.10.10.10/bugz and http://10.10.10.10/github respectively

以下は2つの構成ファイルです

server {
  listen  *:80;
  server_name 10.10.10.10;
  server_tokens off;
  root /home/bugz;

   # individual nginx logs for this gitlab vhost
  access_log  /var/log/nginx/bugzilla_access.log;
  error_log   /var/log/nginx/bugzilla_error.log;

  location /bugz {
      index  index.html index.htm index.pl;
  }


  location ~ \.pl|cgi$ {
      try_files $uri =404;
      gzip off;
      fastcgi_pass  127.0.0.1:8999;
      fastcgi_index index.pl;
      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
      include fastcgi_params;
      }
}

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

server {
#  listen *:80 default_server;         # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
  listen *:80;         # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
  server_name 10.10.10.10;     # e.g., server_name source.example.com;
  server_tokens off;     # don't show the version number, a security best practice
  root /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;

  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;
  }

  }

どうすればこれを達成できますか?

4

2 に答える 2

0

なぜこの膨大な構成が必要なのかわかりません。2 つの場所を持つ 1 つのサイトのみを構成します

server {
    server_name 10.10.10.10;
    location /bugz {
        root /root/to/bugz;
        access_log  /var/log/nginx/bugzilla_access.log;
        error_log   /var/log/nginx/bugzilla_error.log;
        index  index.html index.htm index.pl;
        # try_files statement
    }
    location /git {
        root /home/git/gitlab/public;
        #access and error log and rest of config
    }
    location ~ \.pl|cgi$ { }
    location @gitlab { }
}
于 2013-08-24T17:03:02.127 に答える